嗨,我想用selenium以不同的用户身份打开Internet Explorer-11。我做了一个搜索,结果显示这是可能的,但是对于Java,我使用的是Python,所以我想知道是否可以使用internetexplorerwebdriver。在
例如,如果您右键单击internet explorer,它将使部件以不同的用户身份登录。我想用pythonie webdriver来实现这一部分的自动化,但我不知道如何去做。在
我要问的和这个帖子很相似How to impersonate a specific user with Selenium Webdriver? 但是我想用Python和selenium webdriver来实现
说清楚。我知道如何使用selenium打开webrowser,也知道如何使用selenium登录(当有一个弹出窗口时)。但我问的是如何让selenium知道我想以不同的用户身份登录。因为如果我只是打开我的浏览器,正常情况下不会弹出登录窗口。在
from selenium import webdriver
driver=webdriver.Ie()
谢谢你
根据您的操作系统(Windows 32或64位)下载IE驱动程序
a.Download Windows 32位驱动程序
或者
b.DownloadWindows 64位驱动程序
把拉链打开,然后复印IEDriverServer.exe文件到某个位置,例如:\IEDriver
编写以下脚本
from selenium import webdriver browser = webdriver.Ie("e:\\IEDriver\\IEDriverServer.exe")
“发送用户名”和“提交密码”值。在
运行脚本,它应该打开IE浏览器。。。在
您可以使用Selenium Web Driver。在
了解它,您可以使用类似以下代码执行所需操作:
由于您似乎想使用另一个操作系统用户,我建议您使用Sikuli:
我认为光靠硒是无法达到你想要的效果的。如果您需要集成Selenium和Sikuli,可以在SOF:Calling to a Sikuli script from Python (Selenium)上看到这篇文章。它可以给你一些想法。在
我希望有帮助。在
相关问题 更多 >
编程相关推荐