- imfausActive particpant
- Posts : 13
Join date : 2012-01-13
Help locating a dynamic locator
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:
Login_Login_DNN_txtUsername I tried to use below in the IDE
Any help would be great. Thanks
Example of HTML source:
- freeskyAmateur
- Posts : 72
Join date : 2011-04-13
Re: Help locating a dynamic locator
Fri Jan 13, 2012 9:37 am
you can try function 'contains()' of xpath
- faramkaProfessional
- Posts : 143
Join date : 2011-09-15
Location : Poland
Re: Help locating a dynamic locator
Fri Jan 13, 2012 2:29 pm
As freesky wrote - use xPath.
- imfausActive particpant
- Posts : 13
Join date : 2012-01-13
Re: Help locating a dynamic locator
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?
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?
- freeskyAmateur
- Posts : 72
Join date : 2011-04-13
Re: Help locating a dynamic locator
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.
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.
- imfausActive particpant
- Posts : 13
Join date : 2012-01-13
Re: Help locating a dynamic locator
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:
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:
Add | click | xpath=//input[contains(@id, 'ViewUserManagement_UserCallbackPanel_UserGrid_DXFREditorcol0_I')] |