Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
findElementsByXPath() will return a list of found elements that can be looped through.
Those. if, for example, all the Following buttons have the class "button-text following-text", then by passing the string ".//span[@class='button-text following-text']" to findElementsByXPath() , you can get a list of all buttons following on the page.
getDriver().findElement(By.xpath(".//span[contains(text(),'Following')]")).click()
I recommend learning the XPath Axis and various functions like contains(), text() , count() , etc.
https://ru.wikipedia.org/wiki/XPath
Thanks for the advice ! I tried as you suggested getDriver().findElement(By.xpath(".//span[@class='button-text following-text']")).click(); but fell on this test. There are just a lot of "Following" buttons ... which one it should have pressed and how to press them all in turn and check that they are pressed, that is, then they become "Unfollow".
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question