Re: How to handle random Xpath

152 views
Skip to first unread message

Arran

unread,
May 29, 2013, 10:33:00 AM5/29/13
to seleniu...@googlegroups.com
What is "random" about it?

On Wednesday, 29 May 2013 12:41:30 UTC+1, Rashmi Singh wrote:
Hi All


The problem is that I want to click the Add button of supplied in PrependedInput.


   driver.FindElement(By.Id("prependedInput")).SendKeys("Chetan8");
   driver.FindElement(By.XPath("//li[3]/a/button")).Click();

Avikash Gorka

unread,
May 29, 2013, 11:11:18 AM5/29/13
to Selenium Users
what i understood is that you are searching any user by entering initial few letters of the user in the search textbox. Then some users, would pop put in this form

<UI>
        <Li>
        <Li>
        <Li>
</Ul>

In this case us must know the exact user name which you want to search or atleast that upto that part where you can uniquely identify the user. Depending the name of the user, you would be able to  li using xpath and subsequently add button of that li.



Thanks & Regards,

Avikash Gorka
Sr Test Engineer



--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/7774d785-c79b-47bc-8fed-b3f90c5f61dc%40googlegroups.com?hl=en-US.

For more options, visit https://groups.google.com/groups/opt_out.
 
 

sridhar ..

unread,
May 30, 2013, 5:12:42 AM5/30/13
to seleniu...@googlegroups.com
Hi ,

Take common xpath and put it in list.
My situtaion:
Q)xpath will change dynamically so,followed below process

id=automation-1234
id=automation-5634
id=automation-8254
id=automation-6789
id=automation-7543
id=automation-2478

List<webelemtnt> list=driver.findelements(By.xpath(.//div[@starts-with(@id,"automation")])

if you want to second automation 
list.get(1)

Hop it would help you

Regards
Siddu
Reply all
Reply to author
Forward
0 new messages