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 xpath was:
.js-follow > span:nth-child(1)
"Unable to locate a node using //span[@id='ember637']/a/span"
"Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to locate a node using //span[@id='ember637']/a/span"
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();