Button Click issue

19 views
Skip to first unread message

Sheetal Suri

unread,
Oct 14, 2015, 4:22:08 PM10/14/15
to seleniu...@googlegroups.com
Hello Everyone,

I am new to selenium and I got stuck at clicking the button.

The HTML code of the page is below on which I am executing the script.
I want to click on 3rd button of the page and it seems all buttons have same attribute without id.  Could you please let me know how can I proceed my script to click the button.

<style type="text/css">
<main class="cd-main-content">
<div class="container">
<div class="row">
<div class="group_three">
<div class="col-xs-12 col-sm-6 col-md-4">
<div class="duration_box">
<h2>Appium/Selendroid Users</h2>
<div class="duration_box_inner">
<button class="btn btn-default" onclick="pageurl('http://qtpselenium.com/home/login/Appium-Selendroid');" type="submit">Login to Appium and Selendroid Account</button>
<ul>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-4">
<div class="duration_box">
<h2>QTP Users</h2>
<div class="duration_box_inner">
<button class="btn btn-default" onclick="pageurl('http://qtpselenium.com/home/login/QTP-UFT');" type="submit">Login to QTP Account</button>
<ul>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-4">
<div class="duration_box">
<h2>Selenium Users</h2>
<div class="duration_box_inner">
<button class="btn btn-default" onclick="pageurl('http://qtpselenium.com/home/login/Selenium');" type="submit">Login to Selenium Account</button>
<ul>

Thanks
Sheetal

Mark Collin

unread,
Oct 14, 2015, 5:56:49 PM10/14/15
to Selenium Users
There are probably millions of different locators.  This one should work though:

driver.findElement(By.xpath("//button[.='Login to Selenium Account']"));
Reply all
Reply to author
Forward
0 new messages