You’re not supposed to be able to click on links that a human user can not click. What would this test prove?
Get the devs to expose the link properly, or write a script that performs the pre-requisites for exposing the link before trying to click on it.
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.
So you mean a link within the table, rather than under the table?
If I am now understanding you correctly try using this xpath:
//table[@id=’dgRedactionSet’]/descendant::tr[4]/td/a[.=’Edit’]
This will always click on the fourth row in the table which may be good, or may be bad. I suspect you want to click on a row that has specific text in one of the cells, if you wanted to click on the edit link for the row that has the text Catalyst in the first cell you should instead use an xpath like this:
//table[@id=’dgRedactionSet’]/descendant::tr[td[1][.=’Catalyst’]]/td/a[.=’Edit’]
Regards
Mark
If it works in IDE it proves that the xpath is correct, are you sure you are seeing the same markup in the RC window?
> name="dgRedactionSet:_ctl2:chkIsDefault" X_onclick="HandleCheckBox(this)" />
> </td><td align="Right"
> style="color:#3300FF;font-family:Verdana;font-size:10px;"><a
> href="javascript:__doPostBack('dgRedactionSet$_ctl2$_ctl0','')"
> style="color:#3300FF;">Edit</a></td><td align="Right"
> style="color:Blue;font-family:Verdana;font-size:10px;"><a
> href="javascript:__doPostBack('dgRedactionSet$_ctl2$_ctl1','')"
> style="color:Blue;">Delete</a></td>
> </tr>
>
> Please let me know to solve this problem.
>
> Thanks,
> Sikander
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.
I inspected the element with Xpather.It just works fine in IDE. Even in RC if i sayselenium.isElementPresent("//table[@id=('dgRedactionSet')]/tbody/tr[2]/td[4]/font/a"); - the element is identifying and the test pass.When i click on the same element i.e.,
selenium.click("//table[@id=('dgRedactionSet')]/tbody/tr[2]/td[4]/font/a"); it is giving following error
Where does the test fail if you do:
assertTrue(selenium.isElementPresent("//table[@id=('dgRedactionSet')]/tbody/tr[2]/td[4]/font/a"));
I suspect the element is not there but because you are not checking the result returned by isElementPresent you are not realising that it is returning false.
Regards
Mark
I’ll refer you back to my previous mail which gave you the following XPath:
//table[@id=’dgRedactionSet’]/descendant::tr[td[1][.=’Catalyst’]]/td/a[.=’Edit’]
If this doesn’t work the HTML is not as previously specified, or you are loading the page you think you are loading.
That is scanning through every anchor element in the page and checking where the anchor links to. If you have multiple anchors that link to the same place this will result in selenium just grabbing the first one it finds no matter where it is (so it may not pick up one in a table never mind one in the row you are specifically looking for).
If you are trying to check that a specific link exists in a specific place this is not a good thing to do. Also the query is bad from a performance point of view as it will scan the entire DOM every time rather than scanning a section of the DOM. If you are running tests in a browser with a bad JavaScript implementation (I’m looking at you IE6) you will notice the tests are taking much longer by using an xpath like this.
Do you have a link to the live site that is publically accessible?
One other option is run a W3C validation on the page you are testing and see
if it throws up any errors relating to unclosed elements. If you have an
unclosed element hiding away in there somewhere it could be breaking the DOM
which would cause the XPath to fail even though it should work from the
snippet of HTML that we have seen.
Please let me know...
> *From:* seleniu...@googlegroups.com [mailto:
> seleniu...@googlegroups.com] *On Behalf Of *Mohammed Sikander
> *Sent:* 18 March 2011 11:34
>
> *To:* seleniu...@googlegroups.com
> *Subject:* Re: Re: [selenium-users] Re: How to click on a link which
> is under Table
>
>
>
> No, its not identifying..
>
>
>
> But i found the alternative for this, but this was not i am looking for..=