P Ghanghar P Ghanghar - 4 months ago 20
Java Question

Selenium Webdriver - Element not visible

I am new to selenium webdriver. I am trying to do registration for

http://way2automation.com/way2auto_jquery/index.php
.

I am able to switch to pop up and able to fill all field values. But when I try to click on SUBMIT button it shows exception
Exception in thread "main" org.openqa.selenium.ElementNotVisibleException: element not visible


I have used Xpath with below code:

driver.findElement(By.xpath(".//*[@id='load_form']/div/div[2]/input")).click();


HTML is:

<div class="span_1_of_4" align="center">
<input class="button" type="submit" value="Submit">


Any help will be greatly appreciated. Thanks in advance

Answer

As I see in your provided website url there are two Submit buttons are present, so when you are using xPath .//*[@id='load_form']/div/div[2]/input it returns two submit button and it goes to click on first Submit button which is not visible on the form, So you should try as below :-

driver.findElement(By.cssSelector("div#load_box input.button")).click();

Hope it will work..:)

Comments