Error selenium rich calendar

0 votes

I’m not able to click element in a component. Even using JavaScriptExecutor, the click is still not possible.

public static void selecionarDataCalendario(By by,WebDriver driver,WebDriverWait wait, WebElement webElement) throws Throwable {

    Calendar dat = Calendar.getInstance();

    dat.setTime(new Date());

    SimpleDateFormat formatterMes = new SimpleDateFormat("MM");

    SimpleDateFormat formatterAno = new SimpleDateFormat("YYYY");

    SimpleDateFormat formatterDia = new SimpleDateFormat("dd");

    String mes = formatterMes.format(dat.getTime());

    String ano = formatterAno.format(dat.getTime());

    String dia = formatterDia.format(dat.getTime());

     driver.findElement(by).click();

    Thread.sleep(500);

    driver.findElement(By.xpath("//td[text()='"+ dia +"']")).click();

    Thread.sleep(500);

}
May 24, 2018 in Selenium by Martin
• 4,320 points
437 views

1 answer to this question.

0 votes

See below code:

public static void selecionarDataCalendario(By by,WebDriver driver,WebDriverWait wait, WebElement webElement) throws Throwable {

    Calendar dat = Calendar.getInstance();

    dat.setTime(new Date());

    SimpleDateFormat formatterMes = new SimpleDateFormat("MM");

    SimpleDateFormat formatterAno = new SimpleDateFormat("YYYY");

    SimpleDateFormat formatterDia = new SimpleDateFormat("dd");

    String mes = formatterMes.format(dat.getTime());

    String ano = formatterAno.format(dat.getTime());

    String dia = formatterDia.format(dat.getTime());

    driver.findElement(by).click();

    Thread.sleep(500);

    ArrayList<WebElement> elementos = (ArrayList<WebElement>) driver.findElements(By.xpath("//table[@id='SalvarForm:dataefeito']/tbody/tr/td[text()='"+ dia +"']"));

    for (WebElement elemento: elementos) {

        elemento.click();

    }

    Thread.sleep(500);

}

answered May 24, 2018 by Samarpit
• 5,910 points

Related Questions In Selenium

–1 vote
1 answer

Selenium XPath error:- Element not found

The reason for Element not found exception ...READ MORE

answered Mar 27, 2018 in Selenium by nsv999
• 5,500 points
20,499 views
0 votes
1 answer

Error with Selenium File Upload

In your code, you have used "WebElement" ...READ MORE

answered Mar 30, 2018 in Selenium by nsv999
• 5,500 points
6,222 views
0 votes
1 answer
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
13,676 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,144 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,910 points
7,221 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,875 views
0 votes
1 answer
0 votes
2 answers

Selenium Webdriver Error: org.openqa.selenium.WebDriverException: unknown error: call function result missing 'value'

Facing Error Exception in thread "main" org.openqa.selenium .WebDriverException: unknown ...READ MORE

answered Mar 5, 2020 in Selenium by anonymous
10,220 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP