ADD file via upload

master
prmzba57e 2 years ago
parent ba973d78ae
commit 457e7ba3aa

@ -0,0 +1,39 @@
#pip install selenium
#下载浏览器驱动,可以使用不同浏览器驱动进行选择
# 定义一个输入字符串str对函数进行输入
import time
from selenium.webdriver.common.keys import Keys
from selenium.webdriver import Edge
# 引入模块
from selenium.webdriver.common.by import By
#
# # 改写方法
# dr.find_element(By.XPATH, "my xpath")
web=Edge()
time.sleep(1)
web.get("https://www.qbiqu.com/")
#找到目标网页然后找到input输入框进行输入---有两种实现模式1.输入回车2.按下搜索按钮
time.sleep(2)
inputweb=web.find_element(By.XPATH,'//*[@id="wd"]').send_keys("冰火魔厨",Keys.ENTER)
time.sleep(2)
web.switch_to.window(web.window_handles[-1])
#使用模块提取到目的书籍的url
url=web.current_url
# url=inputweb.current_url
print(url)
# time.sleep(100)
Loading…
Cancel
Save