Display results as :

Rechercher Advanced Search

Latest topics
» Geting issues in identifying the elsements in webdriver
Fri Feb 17, 2017 4:41 pm by janbaskt

» WebDriver - why not to use a singlton for it?
Fri Feb 17, 2017 4:40 pm by janbaskt

» WebDriver session when using testng annotation to invoke driver instance
Fri Feb 17, 2017 4:39 pm by janbaskt

» Selenium fails to launch Chrome
Fri Feb 17, 2017 4:39 pm by janbaskt

» why do i get this error
Fri Feb 17, 2017 4:38 pm by janbaskt

» Selenium Tutorial
Thu Feb 16, 2017 5:21 pm by Rahul

» When to use Selenium IDE, RC and WebDriver
Mon Feb 13, 2017 2:35 pm by azharuddin

» How to integrate selenium with ZAPI-Zephyr
Sat Feb 11, 2017 2:25 am by gseera002c

» Selenium Webdriver
Sat Feb 04, 2017 6:47 pm by


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