Share
Go down
dainova
Active particpant
Active particpant
Posts : 19
Join date : 2012-02-23

Find element with generic name Se, IDE

on Tue Apr 09, 2013 12:43 am
HI,
I need to automate one page and one link got his id/xpath name is kind of generic name (m01submit_111111, m01submit_222222, m01submit_33333...). Every time number portion is different (and there is no logic I see how it changed). This part of verification process.

Is there any way to figure out this id on the fly, I was thinking to look into source, find "m01submit" and take the whole name?
Or there is any other solution,
maybe IDE can work by location ?

or....
Here is a expert from page source, it's td..




Thanks to all
Dai
Code:

...
...
   <td class="table_data_custom">
      <a href="javascript:verifyAccount(12345678)" style="text-decoration:none" id='m01submit_22319907'><b>Add</b></a>
   </td>
      </tr>
...


Last edited by dainova on Tue Apr 09, 2013 3:25 am; edited 3 times in total
ccox
Master
Master
Posts : 205
Join date : 2012-01-06
Age : 33
Location : Denver, CO

Re: Find element with generic name Se, IDE

on Tue Apr 09, 2013 3:14 am
Rather than using the id, use it's XPath. Here is a good reference to try

http://automationtricks.blogspot.com/2010/05/how-to-identify-dynamic-element-in.html
dainova
Active particpant
Active particpant
Posts : 19
Join date : 2012-02-23

Re: Find element with generic name Se, IDE

on Tue Apr 09, 2013 3:24 am
I tried to use xpath, it also features 9999999s in its name.

Actually xPath from Chrome is like this and it works OK, with IDE/FF
ClickAndWait | //*[@id="m01submit_22319907"]/b


And from FF firebug: ** and it doesn't work
/html/body/form/table[5]/tbody/tr[5]/td[3]/a/b

I playing with startwith/contain ..

Thanks
Dai


Last edited by dainova on Tue Apr 09, 2013 3:44 am; edited 1 time in total
ccox
Master
Master
Posts : 205
Join date : 2012-01-06
Age : 33
Location : Denver, CO

Re: Find element with generic name Se, IDE

on Tue Apr 09, 2013 3:27 am
Did you look at the link?

How about this:
//*[starts-with(@id, 'm01submit')]
dainova
Active particpant
Active particpant
Posts : 19
Join date : 2012-02-23

Re: Find element with generic name Se, IDE

on Tue Apr 09, 2013 3:47 am
Thanks, ccox.

Problem solved!!!

Best
Dai
Sponsored content

Re: Find element with generic name Se, IDE

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