Selenium | Unable to find Command button using Selenium Webdriver

Author - Webner
18.03.2016
|
0 Comments
||

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://somesite/view/index.php");
driver.findElement(By.xpath("//button[text()='Ver Encuesta']")).click();
driver.quit();
}
}
Webner Solutions is a Software Development company focused on developing Insurance Agency Management Systems, Learning Management Systems and Salesforce apps. Contact us at dev@webners.com for your Insurance, eLearning and Salesforce applications.

Leave a Reply

Your email address will not be published. Required fields are marked *