Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

0 like 0 dislike
328 views
in Selenium by
recategorized by
I have page where below is HTML of submi button.
 
<div id="submitContainer"><button type="submit" class="large"><span><strong> Create Account </strong></span></button></div>
 
As you can see, button do not have ID and its located inside div. How do I click on this button?
 
Below are few methods I have tried.
 
driver.findElement(By.id("submitContainer")).click();
 
driver.findElement(By.xpath("//*[@id='submitContainer']/button/span/strong")).click();
 
driver.findElement(By.tagName("Create Account")).click();
 
driver.findElement(By.className("large")).click();

1 Answer

1 like 0 dislike
by
selected by
 
Best answer

I guess below xpath should work for you.

 

//button[@type='submit']


This site is for software testing professionals, where you can ask all your questions and get answers from 1300+ masters of the profession. Click here to submit yours now!

...