Beginner :- Problem in finding xpaths for mentioned scenario | Selenium Forum
M
Posted on 18/10/2015
1.My scenario : Click on Login on Selenium Account button.

Problem :

For the various Login button present on Select login page of Qtpselenium.com website (http://qtpselenium.com/home/selectlogin) all login buttons have almost same html paths, i am not able to find any unique property.

for Login on Selenium Account button html path is

<button class="btn btn-default" onclick="pageurl('http://qtpselenium.com/home/login/Selenium');" type="submit">Login to Selenium Account</button>

for Login on QTP Account button

<button class="btn btn-default" onclick="pageurl('http://qtpselenium.com/home/login/QTP-UFT');" type="submit">Login to QTP Account</button>

I am trying to create my own unique partial Xpath to click on Login on Selenium Account button> please help me on this.How can i create its unique xpath and click on it.


2. My scenario: click on play now button of module 13.

Same as above, Xpaths for "Play now" button of every module is same.


a)

<button class="btn btn-default" onclick="pageurl('http://qtpselenium.com/selenium-training/selenium-tutorial/junit-selenium-training');" type="submit">Play Now</button>

b)
<button class="btn btn-default" onclick="pageurl('http://qtpselenium.com/users/modules/Selenium/Module-15');" type="submit">Play Now</button>


for both of the above cases if u suggest me that i will exctract the elements in list and then i click on that particular element please help me how.

M
Replied on 20/10/2015

1.) partial login

try to use text "Login to Selenium Account"

findelement(By.text( "Login to Selenium Account")).click();


2.) you have to use full xpath.