package LianXi;
import junit.framework.Assert;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.By;
import org.openqa.selenium.chrome.ChromeDriver;
public class IsElementTextParent {
public static void main(String[] args) {
// TODO Auto-generated method stub
ChromeOptions options=new ChromeOptions();
options.addArguments("--start-maximized","allow-running-insecure-content","--test-type");
ChromeDriver driver=new ChromeDriver(options);
driver.get("https://www.baidu.com");
String elementText=driver.findElement(By.xpath("//div[@id='ftConw']/p/a[1]")).getText();
Assert.assertEquals("把百度设为主页", elementText);
}
}
网友评论