In the e-commerce demo website provided for automation I am facing problem in locating Continue button present on the page. As far as I know I have tried every possible way to locate that element but each time it is failing to locate. What can I do now?

In the e-commerce demo website provided for automation I am facing problem in locating Continue button present on the page. As far as I know I have tried every possible way to locate that element but each time it is failing to locate.  What can I do now?

@Test

public void continueToCheckout() throws NoSuchElementException, InterruptedException, AWTException {
element = driver.findElement(By.xpath("//*[@id='checkout_page_container']/div[1]/a/span"));

element.submit();
/* //By classname

element = driver.findElement(By.className("step2"));

WebElement e2;

e2 = element.findElement(By.cssSelector("span"));

e2.click();
//  By linkText

driver.findElement(By.linkText("Continue")).submit();

*/

}

Above is the screenshot of the page containing “Continue” element with which I am facing issue and also my code for automation.  The error which is shown on console is “Unable to find element (whatever)” and “The server did not provide any stacktrace information.”

Ruchi Default Asked on July 18, 2016 in Selenium WebDriver.
Add Comment
3 Answer(s)

HI Ruchi,

The first one with Xpath is right and i suggest you to try the same on some other browser and see if it works.

The element locators you have used below are completely wrong, those would not work.

Regards,
Lakshay Sharma

xLov3rDns Professor Answered on July 19, 2016.
Add Comment

I ran the test into IE but it didn’t worked and the reason I am testing in chrome is that firefox is not responding as there are some issues with it.
If you get success in automating that element through chrome then please  let me know.

Ruchi Default Answered on July 20, 2016.
Add Comment

hi ruchi

try explicit  wait

vinaypawar77 Default Answered on September 1, 2016.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.