Selenium WebDriver - Java - Click a button

后端 未结 1 1767
孤街浪徒
孤街浪徒 2021-01-22 18:33

I\'m trying to click some buttons and I\'m using the Follow button on twitch as an example.

I used the Selenium IDE to try to get the xpath for the button. What I got as

相关标签:
1条回答
  • 2021-01-22 19:10

    With PhantomJSDriver, try different locators. Post exceptions if there are any, otherwise post the elemenst's info, e.g. location, text, etc.

    driver.findElement(By.xpath("//*[contains(@class, 'profile-actions')]//span[text()='Follow']")).click();
    driver.findElement(By.cssSelector(".profile-actions .primary_button > span")).click();
    
    0 讨论(0)
提交回复
热议问题