- Zizzy
- Posts : 5
Join date : 2010-11-24
Automation fails, continuous update on page (Java).
Wed Nov 24, 2010 6:36 pm
Here are 2 examples. When recording with IDE i get this code:
selenium.type("u9", "TestH05");
selenium.select("ca", "label=2 - Submission for export");
So obviously when it wants to "type" in a field, it searches for the ID (locator) "u9" and when it looks for the dropdown box, it searches for the ID "ca". Now this page gets updated regularly (daily if you will) and so the IDs (locators) keep changing. So after the page has been updated my code obviously doesn't work anymore since the IDs ("u9" and "ca") changed. Here is an example of what error I would get for the select example: ERROR: Specified element is not a Select (has no options). Obviously, cause the ID can't be found.
Can anyone help me or tell me how to let the code update the IDs (locators) with the changes of the page updates.
Thanks
Kind Regards,
Zizzy
selenium.type("u9", "TestH05");
selenium.select("ca", "label=2 - Submission for export");
So obviously when it wants to "type" in a field, it searches for the ID (locator) "u9" and when it looks for the dropdown box, it searches for the ID "ca". Now this page gets updated regularly (daily if you will) and so the IDs (locators) keep changing. So after the page has been updated my code obviously doesn't work anymore since the IDs ("u9" and "ca") changed. Here is an example of what error I would get for the select example: ERROR: Specified element is not a Select (has no options). Obviously, cause the ID can't be found.
Can anyone help me or tell me how to let the code update the IDs (locators) with the changes of the page updates.
Thanks
Kind Regards,
Zizzy
Re: Automation fails, continuous update on page (Java).
Fri Nov 26, 2010 10:22 pm
Hi,
Try to use xpath or CSS instead of id to locate the object. If the position and option of your object is fixed then u can use those freely.
For xpath , use the xpather add on to create it. With help of xpath you are pointing to specific position not the id.
Ex:
selenium.type("xpath=//div[1]/div[2]/div[2]/form[@id='search-form']/div[@id='search-query']/select[1]", "TestH05");
Try above option, hope this will help you. best of luck.
Bye
Try to use xpath or CSS instead of id to locate the object. If the position and option of your object is fixed then u can use those freely.
For xpath , use the xpather add on to create it. With help of xpath you are pointing to specific position not the id.
Ex:
selenium.type("xpath=//div[1]/div[2]/div[2]/form[@id='search-form']/div[@id='search-query']/select[1]", "TestH05");
Try above option, hope this will help you. best of luck.
Bye
- Zizzy
- Posts : 5
Join date : 2010-11-24
Re: Automation fails, continuous update on page (Java).
Mon Nov 29, 2010 2:28 pm
Thanks for the reply. I am new to xpath, but I downloaded xpath checker. Now the field where I want to type "TestH05" in gives me the following when I say "View XPath":
id('nodeemcsdeclarationsearchnodeemcsdeclarationsearchOriginalLocalReferenceNumber')
So how would I write this in selenium code?
Also, this is to find a "Search" button: id('SearchBtn')/x:tbody/x:tr/x:td/x:span
Thanks
id('nodeemcsdeclarationsearchnodeemcsdeclarationsearchOriginalLocalReferenceNumber')
So how would I write this in selenium code?
Also, this is to find a "Search" button: id('SearchBtn')/x:tbody/x:tr/x:td/x:span
Thanks
- Zizzy
- Posts : 5
Join date : 2010-11-24
Re: Automation fails, continuous update on page (Java).
Mon Nov 29, 2010 6:42 pm
Nevermind, I got it working.
An offtopic question. Does anyone know how to get the XPath of a dropdown box? You cannot right click it to say "XPather" or "View Xpath".
An offtopic question. Does anyone know how to get the XPath of a dropdown box? You cannot right click it to say "XPather" or "View Xpath".
- yoursjcpActive particpant
- Posts : 10
Join date : 2010-07-22
Re: Automation fails, continuous update on page (Java).
Mon Nov 29, 2010 7:11 pm
use firebug to find the xpath easily...
- Zizzy
- Posts : 5
Join date : 2010-11-24
Re: Automation fails, continuous update on page (Java).
Mon Nov 29, 2010 7:40 pm
Thanks for the reply yoursjcp I will have a look and report back. Currently looking at the java source to identify the dropdown xpaths.
- Zizzy
- Posts : 5
Join date : 2010-11-24
Re: Automation fails, continuous update on page (Java).
Tue Nov 30, 2010 5:41 pm
The XPaths keeps changing as well. FML.
- yoursjcpActive particpant
- Posts : 10
Join date : 2010-07-22
Re: Automation fails, continuous update on page (Java).
Wed Dec 15, 2010 4:48 pm
If u have no restrictions can i get the link for which u r chkng??
if u cant send here send me as a PM.
if u cant send here send me as a PM.
- i had already written a java web driver, but, I would like to write a new php page using that java source code
- How do I get one page element in another page using Selenium Webdriver(java code)
- Automation for Java Applets
- Parameterise you login page using java.
- opera browser not loading the page using selenium Rc(Java)
Permissions in this forum:
You cannot reply to topics in this forum
|
|