2 Replies Last post: Jul 7, 2009 3:15 AM by Kwon Hyeyoung  
Kwon Hyeyoung Beginner 4 posts since
Jul 1, 2009
Currently Being Moderated

Jul 2, 2009 3:50 AM

How to get a valid Xpath of object

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

anilkumarch Beginner 40 posts since
Jun 3, 2009
Currently Being Moderated
1. Jul 2, 2009 9:30 AM in response to: Kwon Hyeyoung
Re: How to get a valid Xpath of object

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.

More Like This

  • Retrieving data ...