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,210 points
9 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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,130 points

Related Questions In Selenium

0 votes
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,030 points
1,506 views
0 votes
1 answer

Error with Selenium File Upload

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

answered Mar 29, 2018 in Selenium by nsv999
• 5,030 points
609 views
0 votes
1 answer
0 votes
1 answer

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,030 points
72 views
0 votes
1 answer
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,130 points
444 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
55 views
0 votes
1 answer

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.