Share
Go down
Darknet
Posts : 3
Join date : 2016-04-11

I can onliy click on the first class Element

on Sat Jul 07, 2018 12:22 am
Selenium click onliy te first Class Element. How can i click on the others? after that?


int IDENT = 0;
    while(IDENT < 1)
    {
        IDENT++;
        driver.findElement(By.xpath("//div[@class=\"price\"]["+IDENT+"]")).click();
    }
avatar
Advisor
------------------------
------------------------
Posts : 387
Join date : 2009-07-30
Location : India
http://seleniumforum.forumotion.net

Re: I can onliy click on the first class Element

on Tue Jul 10, 2018 6:45 pm
Please share the full XML which you are trying to do. If your XPath is correct and in a sequential manner, it must click.


I think , you are trying to click these:

//div[@class="price"][1].click()
//div[@class="price"][2].click()
//div[@class="price"][3].click()

But chances are something changes, which are not recognizing your XPath.

_________________
Spread Your Knowledge About Selenium Tool.

Administrator
Email: selenium.discussion.thread@live.com
Forum: http://seleniumforum.forumotion.net
Back to top
Permissions in this forum:
You cannot reply to topics in this forum