selenium简单启动浏览器方式

java


        
            org.seleniumhq.selenium
            selenium-java
            3.141.59
        
        
        
            org.seleniumhq.selenium
            selenium-server
            3.141.59
        

        
            org.testng
            testng
            7.0.0-beta1
            compile
        

      ChromeDriver driver = new ChromeDriver();
        driver.navigate().to("http://www.baidu.com");
        Thread.sleep(6000);
        driver.close();
        driver.findElement(By.id("kw")).sendKeys("百度");

python

    from selenium import webdriver
    driver = webdriver.Firefox(executable_path='D:\pythonspacen\pyt\onea\drive\geckodriver.exe')
    driver.maximize_window()
    driver.get("http://www.baidu.com")
    driver.find_element_by_id("kw").send_keys("美丽")
    driver.find_element_by_xpath('//*[@id="su"]').click()

分享标题:selenium简单启动浏览器方式
当前路径:http://myzitong.com/article/psoosj.html