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://scjbc.cn/article/psoosj.html

其他资讯