Problem: Unable to find the Command button using Selenium Webdriver.
Solution: You can use following script code if you want to find command button on a web page and then click it:
driver.findElement(By.xpath("//button[text()='(Button name)']")).click();
Here is the script which we used in Webdriver:
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class Start
{
public static void main(String[] args) {
WebDriver driver = new FirefoxDriver();
driver.get("http://tarjetasvirtuales.com/view/index.php");
driver.findElement(By.xpath("//button[text()='Ver Encuesta']")).click();
driver.quit();
}
}
