码迷,mamicode.com
首页 > 其他好文 > 详细

[2020-10]selenium v3.14最新例子,漂亮

时间:2020-10-18 10:16:52      阅读:19      评论:0      收藏:0      [点我收藏+]

标签:cto   attr   enc   int   result   tco   pytho   firefox   sele   

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support.expected_conditions import presence_of_element_located

#This example requires Selenium WebDriver 3.13 or newer
with webdriver.Firefox() as driver:
    wait = WebDriverWait(driver, 10)
    driver.get("https://google.com/ncr")
    driver.find_element(By.NAME, "q").send_keys("cheese" + Keys.RETURN)
    first_result = wait.until(presence_of_element_located((By.CSS_SELECTOR, "h3>div")))
    print(first_result.get_attribute("textContent"))

  

[2020-10]selenium v3.14最新例子,漂亮

标签:cto   attr   enc   int   result   tco   pytho   firefox   sele   

原文地址:https://www.cnblogs.com/yicaifeitian/p/13832992.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有 京ICP备13008772号-2
迷上了代码!