dimanche 25 novembre 2018

Element not visible for check box though its available

I am trying to tick a checkbox using Selenium. The page looks like below.

enter image description here

Then when I click on edit, it changes to the below shown format.

enter image description here

At this time, I can select the checkbox from Chrome dev tools using the below shown xpath.

//input[@name='value[326071]']

Below is how the DOM looks.

enter image description here

I have put a thread wait before clicking on the check box. Below is my code.

Thread.sleep(5000);
WebElement assignWorkSpaceElement = chromeDriver.findElement(By.xpath("//input[@name='value[326071]']"));
assignWorkSpaceElement.click();

I tried with the below xpath as well. Still no luck. I am debugging the code through IntelliJ and prior to going over the web element line, I am able to select the checkbox from Chrome dev tools. Its clearly there.

//*[contains(@class,'col-md-8')]//input[@name='value[326074]']

but when I execute the code, I get the following exception.

org.openqa.selenium.ElementNotVisibleException: element not visible
  (Session info: chrome=70.0.3538.110)
  (Driver info: chromedriver=2.40.565386 (45a059dc425e08165f9a10324bd1380cc13ca363),platform=Mac OS X 10.13.6 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds

What am I doing wrong here? Any help would be much appreciated.




Aucun commentaire:

Enregistrer un commentaire