Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» Run automated selenium test scripts from JIRA ondemand
Fri Dec 08, 2017 12:40 pm by azharuddin

» New! Appium Desktop
Sat Nov 25, 2017 3:51 pm by azharuddin

» Selenium WebDriver Integration
Tue Nov 21, 2017 1:06 pm by azharuddin

» how to connect DB in selenium webriver
Fri Oct 06, 2017 4:09 pm by anbarasi

» How find any text in browser screen and click on it?
Thu Oct 05, 2017 2:02 pm by sandeepkommineni

» Selenium Webdriver
Tue Oct 03, 2017 1:35 pm by PiyushBiswas

» GRID setup tutorial.
Wed Sep 27, 2017 4:29 pm by johnyapp

» Drag & Drop Between Windows Using Selenium Driver
Wed Sep 27, 2017 2:10 pm by 26rondel

» Check if window is closed / verify input
Sat Sep 23, 2017 10:21 pm by brainstir

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

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')]

ccwolters

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.


cyssor

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