我按照本教程安装了量角器,当我使用webdriver-manager更新时,它说:
selenium standalone is up to date.
chromedriver is up to date.
Run Code Online (Sandbox Code Playgroud)
当你尝试进行量角器测试时,它说:
C:\Users\****\AppData\Roaming\npm\node_modules\protractor\lib\driverProviders\local.dp.js:42
throw new Error('Could not find chromedriver at ' +
^
Error: Could not find chromedriver at C:\Users\****\AppData\Roaming\npm\node_modules\protractor\selenium\chromedriver.exe
at LocalDriverProvider.addDefaultBinaryLocs_ (C:\Users\****\AppData\Roaming\npm\node_modules\protractor\lib\driverProviders\local.dp.js:42:15)
at LocalDriverProvider.setupEnv (C:\Users\****\AppData\Roaming\npm\node_modules\protractor\lib\driverProviders\local.dp.js:59:8)
at Runner.run (C:\Users\****\AppData\Roaming\npm\node_modules\protractor\lib\runner.js:308:31)
at process.<anonymous> (C:\Users\****\AppData\Roaming\npm\node_modules\protractor\lib\runFromLauncher.js:32:14)
at process.EventEmitter.emit (events.js:98:17)
at handleMessage (child_process.js:318:10)
at Pipe.channel.onread (child_process.js:345:11)
[launcher] Runner Process Exited With Error Code: 8
Run Code Online (Sandbox Code Playgroud)
我检查了local.dp.js并看到它试图从.. \node_modules\protractor\selenium\chromedriver加载chromedriver但是只有一个名为chromedriver_2.9的空zip文件.
所以我手动下载了chromedriver并将其复制到这个位置,产生了一个新的错误:
C:\Users\****\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:1549
throw error;
^
Error: Server exited with 1 …Run Code Online (Sandbox Code Playgroud) 有没有办法使用python selenium WebDriver最大化chrome浏览器窗口?
注意:我正在使用Chrome驱动程序23.0任何解决方案都将非常感谢!
我有一个奇怪的案例,其中selenium chrome驱动程序getText()方法(java)为某些元素返回一个空字符串,即使它为其他元素返回一个非空字符串xpath.这是一个页面.
<div __gwt_cell="cell-gwt-uid-223" style="outline-style:none;">
<div>Text_1</div>
<div>Text_2</div>
<div>Text_3</div>
<div>Text_4</div>
<div>Text_5</div>
<div>Text_6</div>
</div>
Run Code Online (Sandbox Code Playgroud)
每个内标签的,我可以得到有效的返回值getTagName(),getLocation(),isEnabled(),和isDisplayed().但是,getText()为某些div返回一个空字符串.
此外,我注意到如果我使用mac chrome驱动程序,它始终是'Text_5',getText()返回一个空字符串.如果我使用Windows Chrome驱动程序,它始终是'Text_2',getText()返回一个空字符串.如果我使用firefox驱动程序,则getText()返回所有div的预期文本.
有没有其他人有这个困难?
在我的代码中,我使用这样的东西......
ArrayList<WebElement> list = (ArrayList<WebElement>) driver.findElements(By.xpath(“my xPath here”));
for (WebElement e: list) System.out.println(e.getText());
Run Code Online (Sandbox Code Playgroud)
如下所示,这是xPath我正在使用的实际情况.上面的页面代码段处理最后两个div.
//*[@class='gwt-DialogBox']//tr[contains(@class,'data-grid-table-row')]//td[contains(@class,'lms-assignment-selection-wizard-cell')]/div/div
Run Code Online (Sandbox Code Playgroud) 我正在研究一个用于网络搜索的python脚本,并且已经走上了使用Chromedriver作为其中一个软件包的道路.我希望这在没有任何弹出窗口的情况下在后台运行.我在chromedriver上使用'headless'选项,它似乎没有显示浏览器窗口,但是,我仍然看到.exe文件正在运行.看到我正在谈论的截图.截图
这是我用来启动ChromeDriver的代码:
options = webdriver.ChromeOptions()
options.add_experimental_option("excludeSwitches",["ignore-certificate-errors"])
options.add_argument('headless')
options.add_argument('window-size=0x0')
chrome_driver_path = "C:\Python27\Scripts\chromedriver.exe"
Run Code Online (Sandbox Code Playgroud)
我试图做的事情是将选项中的窗口大小改为0x0,但我不确定是什么,因为.exe文件仍然弹出.
有关如何做到这一点的任何想法?
我使用的是Python 2.7 FYI
python selenium selenium-chromedriver selenium-webdriver google-chrome-headless
我的代码:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
option = webdriver.ChromeOptions()
driver = webdriver.Chrome(executable_path='./chromedriver.exe', options=option)
driver.get('https://www.google.com/')
Run Code Online (Sandbox Code Playgroud)
输出:
WebDriver.__init__() got an unexpected keyword argument 'executable_path'
Run Code Online (Sandbox Code Playgroud)
我正在尝试创建一个脚本来登录网站。当我尝试运行此脚本时,它给出了以下错误:
WebDriver.__init__() got an unexpected keyword argument 'executable_path'
引用错误消息:'chromedriver'可执行文件需要在PATH中
我试图在pycharm中使用selenium编写脚本代码.但后来我得到了上述错误.我已将我的selenium链接到pycharm,如下所示:https://gyazo.com/b5622e3165bbfd93cfa205178df79b6f - (新鲜和最新)
我是selenium的新手,在"selenium"文件夹中不是chromedriver.如果它不在哪里可以找到并将其添加到路径中?
顺便说一句,我尝试在cmd中键入"chromedriver",它不被认为是内部或外部命令.
错误如下所示:
Traceback (most recent call last):
File "C:\Users\sebastian\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\common\service.py", line 64, in start
stdout=self.log_file, stderr=self.log_file)
File "C:\Users\sebastian\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py", line 947, in __init__
restore_signals, start_new_session)
File "C:\Users\sebastian\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py", line 1224, in _execute_child
startupinfo)
PermissionError: [WinError 5] Permission denied
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/sebastian/PycharmProjects/web/bot.py", line 10, in <module>
browser = webdriver.Chrome("C:/Users/sebastian/desktop/selenium-3.0.1")
File "C:\Users\sebastian\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 62, in __init__
self.service.start()
File "C:\Users\sebastian\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\common\service.py", line 76, in start
os.path.basename(self.path), self.start_error_message) …Run Code Online (Sandbox Code Playgroud) 我是一个javascript/java开发人员,我一直在试图弄清楚selenium webdriver自动化框架如何从文件系统上传文件.无法通过javascript设置文件输入,因为它是安全违规.然而,不知何故,webdriver能够使用以下命令执行此操作:
driver.setFileDetector(new LocalFileDetector());
WebElement upload = driver.findElement(By.id("myfile"));
upload.sendKeys("/Users/sso/the/local/path/to/darkbulb.jpg");
driver.findElement(By.id("submit")).click();
Run Code Online (Sandbox Code Playgroud)
所以他们通过发送密钥来设置价值?我不明白.我查看了此处的源代码:http: //code.google.com/p/selenium/source/checkout 我仍然无法找到他们这样做的地方.
编辑:我的问题不是如何用selenium做这个,但是硒开发人员是如何做到这一点的呢?他们是如何解决javascript中的安全限制的?他们如何上传文件?
selenium automation webdriver browser-automation selenium-chromedriver
任何人都可以告诉我在哪里可以找到64位版本的chromedriver.exe?我用32位也试了但是它没有调用main方法.
当我使用chromedriver使用selenium进行测试时,我收到此错误.
selenium.common.exceptions.WebDriverException: Message: u'unknown error: Chrome failed to start: exited abnormally\n (Driver info: chromedriver=2.9.248316,platform=Linux 3.8.0-29-generic x86)'
Run Code Online (Sandbox Code Playgroud)
我确实下载了google-chrome stable和chromedriver,并使用此代码启动浏览器.
driver = webdriver.Chrome('/usr/local/bin/chromedriver')
Run Code Online (Sandbox Code Playgroud)
有人建议吗?谢谢.
我遇到了以下问题:当我运行自动化测试时,我在Chrome中不断收到以下警告"禁用开发人员模式扩展".

有没有办法删除/禁用此功能?这对我来说是一个阻碍因为它让我失败了一些测试.
提前致谢
selenium ×8
python ×3
java ×2
angularjs ×1
automation ×1
protractor ×1
python-2.7 ×1
python-3.x ×1
testing ×1
webdriver ×1
windows ×1