Display results as :

Rechercher Advanced Search

Latest topics
» FlexMonkium Download Not available under Gorillalogic site
Thu Dec 08, 2016 5:40 pm by bhanu.praveen

» Selenium Script issue
Tue Dec 06, 2016 9:48 pm by njain213

» Difference between QTP, Selenium and Silk test
Tue Dec 06, 2016 7:58 pm by jessicacyrus1

» Where does selenium script pick browser from
Tue Dec 06, 2016 1:52 pm by janbaskt

» Safari throws an HTTP ERROR: 404
Tue Dec 06, 2016 1:51 pm by janbaskt

» Access Denied Error in Selenium RC
Tue Dec 06, 2016 1:51 pm by janbaskt

» Automating Flex application through selenium webdriver
Fri Dec 02, 2016 2:06 pm by abhinay.krs

» Starting with Selenium, what is Selenium?
Mon Nov 28, 2016 4:00 pm by Foma

» Getting started with Selenium
Mon Nov 28, 2016 3:23 pm by Rebbelx


Tough element to locate, need help

View previous topic View next topic Go down

Tough element to locate, need help

Post by ccwolters on Sat Jun 23, 2012 1:07 pm

I have seen the posts on using XPATh to locate dynamic elements. However, I have not seen anyone with a problem like this:

I am trying to click on a link that expands and collapses a div area. The image is named dynamically for example on the first page load the image for this icon will be named img_24, but when I refresh, the name changes to img_32. There are a number of these icons on a page, each associated with a gadget. So, when img_24 changes to img_32, it will now open a different gadget on the page. Can XPATH be used to locate an element using 2 test, one for the title of the gadget (which is constant) and a 2nd for the pattern matching for img_??

XPath: //button[starts-with(@id, 'img_')] AND //text in the same frame[starts-with('Gadget Number 10')]


Posts : 1
Join date : 2012-06-23

Back to top Go down

Re: Tough element to locate, need help

Post by cyssor on Mon Jun 25, 2012 9:54 pm

I'm pretty sure Selenium allows you to "pipe" in a format similar to (using your example)

XPath: //button[starts-with(@id, 'img_')] | //button[starts-with('Gadget Number 10')]

Not exactly sure if that is the correct statement but I would suggest looking up the usage of " | " in Selenium.

Example from W3schools.

//book/title | //book/price Selects all the title AND price elements of all book elements
//title | //price Selects all the title AND price elements in the document
/bookstore/book/title | //price Selects all the title elements of the book element of the bookstore element AND all the price elements in the document.

Hope this helps some.


Posts : 5
Join date : 2012-06-15

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