Search
 
 

Display results as :
 


Rechercher Advanced Search

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Help locating a dynamic locator

View previous topic View next topic Go down

Help locating a dynamic locator

Post by imfaus on Fri Jan 13, 2012 4:31 am

I am using IDE 1.4.1 It turns out the application i am testing many of the 'locators' change. For example the login page the username input field changed from id="dnn_ctr910_Login_Login_DNN_txtUsername" to id="dnn_ctr633_Login_Login_DNN_txtUsername" as a result it caused the automation to fail. I see there was a post on how to find an element dynamically but it was for a radio button I need it for an input field. I need a way to look for the element where it ends with
Login_Login_DNN_txtUsername I tried to use below in the IDE

storeAttribute
Login_Login_DNN_txtUsername@id
userNameInputfield


Any help would be great. Thanks

Example of HTML source:

imfaus
Active particpant
Active particpant

Posts : 13
Join date : 2012-01-13

Back to top Go down

Re: Help locating a dynamic locator

Post by freesky on Fri Jan 13, 2012 9:37 am

you can try function 'contains()' of xpath

freesky
Amateur
Amateur

Posts : 72
Join date : 2011-04-13

Back to top Go down

Re: Help locating a dynamic locator

Post by faramka on Fri Jan 13, 2012 2:29 pm

As freesky wrote - use xPath.

faramka
Professional
Professional

Posts : 143
Join date : 2011-09-15
Location : Poland

Back to top Go down

Re: Help locating a dynamic locator

Post by imfaus on Fri Jan 13, 2012 7:51 pm

Sorry I am not that good with xpath here is what I am using and its failing to work

store
xpath=id('//input[contains(@id, 'Login_Login_DNN_txtPassword')]')
userinputfield



I know the value that the locator will end with each time
Login_Login_DNN_txtPassword knowing this what exactly should the xpath look like?

imfaus
Active particpant
Active particpant

Posts : 13
Join date : 2012-01-13

Back to top Go down

Re: Help locating a dynamic locator

Post by freesky on Mon Jan 16, 2012 6:55 pm

u can use
type
//input[contains(@id, 'Login_Login_DNN_txtPassword')]
3

if the id of field password alway ends with 'Login_Login_DNN_txtPassword', i think this should work.

freesky
Amateur
Amateur

Posts : 72
Join date : 2011-04-13

Back to top Go down

Re: Help locating a dynamic locator

Post by imfaus on Mon Jan 16, 2012 10:47 pm

Ok this worked thank you so much! I did have two more questions:
1) how would you do this if you wanted to click a link say the id changes dynamically but the link string in the UI stays the same for example, html source is:






I tried to run this in the IDE and if failed
xpath=//a[text()='add']/@href


Secondly How would you do this for a search field again like the example I initially presented where I know the string that the locator will end with
ViewUserManagement_UserCallbackPanel_UserGrid_DXFREditorcol0_I
Below is the html source. I tried to use this in the IDE and it failed




class="dxeEditArea_Default dxeEditAreaSys ">

imfaus
Active particpant
Active particpant

Posts : 13
Join date : 2012-01-13

Back to top Go down

Re: Help locating a dynamic locator

Post by freesky on Tue Jan 17, 2012 9:03 am

1) for example, if u want to locate this topic, then in ide, it'll look like next :

open http://seleniumforum.forumotion.net/f3-selenium-ide-discussion
click //div[@id='main-content']//a[text()='Help locating a dynamic locator']

freesky
Amateur
Amateur

Posts : 72
Join date : 2011-04-13

Back to top Go down

Re: Help locating a dynamic locator

Post by Sponsored content Today at 3:13 pm


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

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

Add
click xpath=//input[contains(@id, 'ViewUserManagement_UserCallbackPanel_UserGrid_DXFREditorcol0_I')]