Hello
I have several questions on Xpath and generation scripts
1) Get a valid Xpath of obejct
I'm trying to make Selenium IDE script to test Web application.
This application has been developed via ExtJS so all objects has its dinamic identifier such as "//div[@id='ext-gen250']/div[1]/table/tbody/tr/td[1]/div/div"
However, if additional features are developed, the identifier will be changed.
I was told that Xpath will be used to avoid this type of problem.
So I changed the value from "//div[@id='ext-gen250']/div[1]/table/tbody/tr/td[1]/div/div" to "//tbody/tr/td[1]/div/div"
If there's only 1 table in target page, It works fine, but if there are 2 or more tables, this would not work properly.
Anybody know the solution?
2) Click button in table
There is a button in table object.
I've got follwoing script via Selenium IDE recording
<tr>
<td>click</td>
<td>//div[@id='ext-gen503']/div[1]/table/tbody/tr/td[6]/div/table/tbody/tr/td[2]/em/button</td>
<td>Save as Template</td>
</tr>
But when running above script, Selenium IDE log says it performed successfully but it's failed actually (if success, dialog should pop up)
How can I click button in table without problem?
3) How to click checkbox with no text(string)
There's a checkbox with no text or image (the checkbox is checked only if click the checkbox)
I've got following script to click the checkbox
<td>click</td>
<td>//div[@id='ext-gen250']/div[1]/table/tbody/tr/td[1]/div/div</td>
<td></td>
But when running above script, Selenium IDE log says it executed normally,
but Checkbox is not checked (not enabled)
How can I click the checkbox ? (if the checkbox has static string, when to click the string, it works fine but in this case, there's no static string next to the checkbox)
4) How to click button which has only ext-gen ID
This question could be same with question #1.
There are several buttons which have only ext-gen ID. e.g If I get the identifier from DOM plug-in or Selenium IDE,
the value is "ext-gen165" things like that.
But to avoid the ext-get , I have to use Xpath, but I don't know how to do that.
Pls let me know how to solve these problems
Hi,
U can download and use XPather and Xpath checker.
this will help u how to get XPath.
u just need to go to that element and right+click and select 'Show in Xpather' or 'View Xpath'.
It gives u the Xpath.
Yes I know how to get Xpath via Xpather plug-in
But my application has buttons getting dinamic id (the id could be changed )
What I like to know is how to eliminate dependency this dinamic ID using Xpath.
Somebody said that dependency to dinamic ID can be eliminated by using Xpath,
But I can not figure out how to do that.
because when I get xpath from any button, it has still dinamic ID like this
: /html[@class='x-viewport']/body[@class='ext-gecko' and @id='ext-gen6']/div[@class='x-window syncthru-device-details x-resizable-pinned' and @id='ext-comp-1071']/div[@class='x-window-bwrap' and @id='ext-gen608']/div[@class='x-window-bl' and position()=2]/div[@class='x-window-br']/div[@class='x-window-bc']/div[@class='x-window-footer' and @id='ext-gen610']/div[@class='x-panel-btns-ct']/div[@class='x-panel-btns x-panel-btns-right']/table/tbody/tr/td[@class='x-panel-btn-td' and @id='ext-gen625']/table[@class='x-btn-wrap x-btn' and @id='ext-comp-1076']/tbody/tr/td[@class='x-btn-center' and position()=2]
