- sutcha
- Posts : 2
Join date : 2012-05-03
Problems finding element due to various IDs/locators
Thu May 03, 2012 8:37 pm
Hi there,
I try to migrate an older selenium project to WebDriver (hope to get more stable results there...).
About my problems:
1. I use lots of methods like selenium.click(locator). Is there any possibility to map this "feature" to WebDriver?
The locator can be an ID, xPath, name etc., so I don't want to refactor each method call to a specific method call with strategy
2. is there a possibility to wait for the first element of a list to appear?
Background: The application I am testing with selenium isn't designed for tests, so some elemtens (e.g. OK-Button) has normal IDs on one site (actionOK), dynamic IDs (ab_1281) or different IDs on every site (actionOk, ctrl_ok). So I have a list with all known IDs, text etc. for each element. In selenium 1 I poll the page until I found the first occurence => this is my target element.
Do you see any possibility to realise this with the WebDriver?
kind regards
I try to migrate an older selenium project to WebDriver (hope to get more stable results there...).
About my problems:
1. I use lots of methods like selenium.click(locator). Is there any possibility to map this "feature" to WebDriver?
The locator can be an ID, xPath, name etc., so I don't want to refactor each method call to a specific method call with strategy
2. is there a possibility to wait for the first element of a list to appear?
Background: The application I am testing with selenium isn't designed for tests, so some elemtens (e.g. OK-Button) has normal IDs on one site (actionOK), dynamic IDs (ab_1281) or different IDs on every site (actionOk, ctrl_ok). So I have a list with all known IDs, text etc. for each element. In selenium 1 I poll the page until I found the first occurence => this is my target element.
Do you see any possibility to realise this with the WebDriver?
kind regards
Re: Problems finding element due to various IDs/locators
Mon May 07, 2012 11:48 am
For your first question, this post of mine might help -
http://www.seleniumtests.com/2012/01/selenium-2-methods-are-no-more-weird.html
For your second question on polling/waiting, This doc might help -
http://seleniumhq.org/docs/04_webdriver_advanced.html#explicit-and-implicit-waits
http://www.seleniumtests.com/2012/01/selenium-2-methods-are-no-more-weird.html
For your second question on polling/waiting, This doc might help -
http://seleniumhq.org/docs/04_webdriver_advanced.html#explicit-and-implicit-waits
- sutcha
- Posts : 2
Join date : 2012-05-03
Re: Problems finding element due to various IDs/locators
Mon May 07, 2012 1:39 pm
Thanks for these links.
To be more precisely on my problems:
I do mySeleniumUtils.click(String[] locators) which will look/wait for element by xpath, id, text at the same time. So the first element found will be the right one, so the one to click.
With the WebDriver I need to findElements(By.xpath), ...(By.ID) etc. and I need to know whether my current locator is an id, xpath etc.
Hope you understand my problem.
To be more precisely on my problems:
I do mySeleniumUtils.click(String[] locators) which will look/wait for element by xpath, id, text at the same time. So the first element found will be the right one, so the one to click.
With the WebDriver I need to findElements(By.xpath), ...(By.ID) etc. and I need to know whether my current locator is an id, xpath etc.
Hope you understand my problem.
Permissions in this forum:
You cannot reply to topics in this forum