Selenium Forum: Functional And Regression Testing Tool.
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
Display results as :
Advanced Search
Latest topics
AEM Training | Free Online DemoWed Apr 21, 2021 5:45 pmazharuddin
c# PageFactory - issue initializing elementsFri Nov 01, 2019 8:40 pmthegoatboy
Selenium making automatic connection to random urlsMon Jul 08, 2019 12:58 pmrepairtechsolutions1
How can we design the custom framework in Selenium RCMon Jun 24, 2019 2:26 pmrandybonnettes
What are the new features in Selenium 3.0Tue Jun 18, 2019 5:37 pmpappyvicky
What are you using Selenium for? Fri Apr 12, 2019 3:52 amzhl
LIMITATIONS OF SELENIUMWed Apr 10, 2019 11:23 amswara
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Go down
avatar
a71688
Regular Participant
Regular Participant
Posts : 27
Join date : 2014-07-23

2 Button exist with same name. How to make the script instead of using positions.. Empty 2 Button exist with same name. How to make the script instead of using positions..

Mon Oct 27, 2014 7:00 pm
Hi,

I have following problem i.e. on my application I have 2 'Add' buttons in different position and xpath viewer says:


id('expanded')/x:li[1]/x:div/x:div/x:div/x:table/x:tbody/x:tr[1]/x:td[4]/x:a/x:img

One match found

1 +

id('expanded')/x:li[2]/x:div/x:div/x:div/x:table/x:tbody/x:tr[2]/x:td[4]/x:a/x:img

One match found

1 +



Code is:


open
${baseurl}/produkter/nemid_medarbejdersignatur/nemid_selvbetjening/Add_services/



waitForPageToLoad
60000



click
link=Add services



click
xpath=(//img[@alt='Add'])[9]



waitForElementPresent
name=_eventId_continue



clickAndWait
name=_eventId_continue




The position changes when more functionality is added.So I want that Selenium to click on 'Add' button next to where title is like 'Car A'and where I am not depended on position.

Above scenario work as i know the position, but I want it to be independent of position.

How shall i Write it..
avatar
ccox
Master
Master
Posts : 205
Join date : 2012-01-06
Age : 39
Location : Denver, CO

2 Button exist with same name. How to make the script instead of using positions.. Empty Re: 2 Button exist with same name. How to make the script instead of using positions..

Sat Nov 01, 2014 2:09 am
Tell your developers to use unique IDs. Otherwise you are going to have to use XPath.
avatar
a71688
Regular Participant
Regular Participant
Posts : 27
Join date : 2014-07-23

2 Button exist with same name. How to make the script instead of using positions.. Empty Query solved

Fri Nov 14, 2014 11:13 pm
Solved
Sponsored content

2 Button exist with same name. How to make the script instead of using positions.. Empty Re: 2 Button exist with same name. How to make the script instead of using positions..

Back to top
Permissions in this forum:
You cannot reply to topics in this forum