admin管理员组文章数量:1023866
第一步:下载 selenium驱动器 for 微软Edge浏览器: Microsoft WebDriver
https://developer.microsoft/en-us/microsoft-edge/tools/webdriver/#downloads
版本选择:打开python命令行,运行:help(selenium) 可以看到selenium的版本信息。
如果webdriver跟操作系统不匹配,那么是驱动不了浏览器的。
查看自己win10操作系统build的方法:
开始-设置-系统-关于-OS版本 像我的电脑就是14393.447的 所以驱动我就下的是Release 14393
查看自己电脑上edge的版本号(html的):打开Edge->settings
将WebDriver下载并拷贝到python的Path路径下,python可以自动搜索到。
示例代码如下:
from selenium import webdriver
import time
driver=webdriver.Edge()
driver.get("https://www.ondemand.sas/jira/issues/?filter=22079") #打开网址
time.sleep(10)
driver.find_element_by_link_text("logging in").click() #点击链接后driver代表了新的url对应的页面。
time.sleep(10)
pwd=driver.find_element_by_id('login-form-password')
pwd.send_keys('password') #password
usr=driver.find_element_by_id('username-fake')
usr.send_keys('usrname')
sub=driver.find_element_by_id('login-form-submit')
sub.click()
第一步:下载 selenium驱动器 for 微软Edge浏览器: Microsoft WebDriver
https://developer.microsoft/en-us/microsoft-edge/tools/webdriver/#downloads
版本选择:打开python命令行,运行:help(selenium) 可以看到selenium的版本信息。
如果webdriver跟操作系统不匹配,那么是驱动不了浏览器的。
查看自己win10操作系统build的方法:
开始-设置-系统-关于-OS版本 像我的电脑就是14393.447的 所以驱动我就下的是Release 14393
查看自己电脑上edge的版本号(html的):打开Edge->settings
将WebDriver下载并拷贝到python的Path路径下,python可以自动搜索到。
示例代码如下:
from selenium import webdriver
import time
driver=webdriver.Edge()
driver.get("https://www.ondemand.sas/jira/issues/?filter=22079") #打开网址
time.sleep(10)
driver.find_element_by_link_text("logging in").click() #点击链接后driver代表了新的url对应的页面。
time.sleep(10)
pwd=driver.find_element_by_id('login-form-password')
pwd.send_keys('password') #password
usr=driver.find_element_by_id('username-fake')
usr.send_keys('usrname')
sub=driver.find_element_by_id('login-form-submit')
sub.click()
本文标签: 打开网页浏览器edgepythonselenium
版权声明:本文标题:python模拟打开Edge浏览器并打开网页(selenium+edge) 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/jiaocheng/1741132986a1834538.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论