import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; public class OpenWeb { public static void main(String[] args) throws InterruptedException { System.setProperty("webdriver.chrome.driver", "C:\\Users\\admin\\Desktop\\chromedriver.exe"); System.setProperty("webdriver.chrome.bin", "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"); WebDriver driver = new ChromeDriver(); driver.get("http://www.baidu.com/"); driver.manage().window().maximize(); WebElement txtbox = driver.findElement(By.id("kw")); txtbox.sendKeys("Glen"); WebElement btn = driver.findElement(By.id("su")); btn.click(); Thread.sleep(3000); driver.close(); driver.quit(); } }
web ui自动化demo
最新推荐文章于 2023-07-17 11:21:29 发布