对于想了解PhantomJS在Selenium上意外退出:WebDriverException,状态码为127的读者,本文将是一篇不可错过的文章,我们将详细介绍selenium退出,并且为您提供关于a
对于想了解PhantomJS在Selenium上意外退出:WebDriverException,状态码为127的读者,本文将是一篇不可错过的文章,我们将详细介绍selenium 退出,并且为您提供关于appium 报错:selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occu、appium启动服务,链接app报错elenium.common.exceptions.WebDriverException: Message: An unknown server-side erro、Phantomjs Selenium WebDriver中的自定义标头、ruby – 在selenium webdriver中使用带有phantomjs的代理的有价值信息。
本文目录一览:- PhantomJS在Selenium上意外退出:WebDriverException,状态码为127(selenium 退出)
- appium 报错:selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occu
- appium启动服务,链接app报错elenium.common.exceptions.WebDriverException: Message: An unknown server-side erro
- Phantomjs Selenium WebDriver中的自定义标头
- ruby – 在selenium webdriver中使用带有phantomjs的代理
PhantomJS在Selenium上意外退出:WebDriverException,状态码为127(selenium 退出)
我在Mac OS X上使用全局PhantomJS,用于多个Javascript和Pythonselenium项目。第一次,我使用virtualenv设置了一个虚拟环境:
virtualenv Python3.5 Path/To/MyEnvironnement
然后 :
Path/To/MyEnvironnement. bin/activatewhich phantomjs
…返回我的全局selenium:/Users/Me/.npm-packages/bin/phantomjs
但是每次我打电话:
driver = webdriver.PhantomJS(executable_path=r''/Users/Me/.npm-packages/bin/phantomjs'')
我收到此错误:
Traceback (most recent call last):File "/Path/To/MyEnvironnement/script/spider/crawl/Urls.py", line 194, in <module>init_driver()File "/Path/To/MyEnvironnement/script/spider/crawl/Urls.py", line 29, in init_driverdriver = webdriver.PhantomJS(executable_path=r''/Users/Me/.npm-packages/bin/phantomjs'')File "/Path/To/MyEnvironnement/lib/python3.5/site-packages/selenium/webdriver/phantomjs/webdriver.py", line 52, in __init__self.service.start()File "/Path/To/MyEnvironnement/lib/python3.5/site-packages/selenium/webdriver/common/service.py", line 86, in startself.assert_process_still_running()File "/Path/To/MyEnvironnement/lib/python3.5/site-packages/selenium/webdriver/common/service.py", line 99, in assert_process_still_running% (self.path, return_code)selenium.common.exceptions.WebDriverException: Message: Service /Users/Me/.npm-packages/bin/phantomjs unexpectedly exited. Status code was: 127
自从我第一次遇到此问题以来已经过了24小时,而且我阅读了几乎所有可能涉及此问题的帖子。
我试图在我的virtualenv内创建一个nodeenv,但没有成功:在pythonvirtualenv内的Selenium项目中运行phantomjs
答案1
小编典典我想为时已晚,但是为了解决这个问题,我通过以下方式解决了这个问题:
sudo apt-get install libfontconfig
答案在这里找到:
使用python和selenium连接到phantomJsWebdriver时出现问题
appium 报错:selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occu
appium进行手机浏览器的自动化测试启动代码如下
#使用手机浏览器进行自动化测试 import time from appium import webdriver #自动化配置信息 des={ 'platformName': 'Android', 'platformVersion': '8.0', #填写android虚拟机的系统版本 'deviceName': 'SamSung galaxy S9', #填写安卓虚拟机的设备名称---值可以随便写 'browserName': 'chrome', # 直接指定浏览器名称参数为chrome【重点添加了这一步】 'udid': '192.168.235.103:5555', # 填写通过命令行 adb devices 查看到的 uuid 'noreset': True, # 确保自动化之后不重置app 'unicodeKeyboard': True, 'resetKeyboard': True, 'chromedriverExecutable': r"C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-chromedriver\chromedriver\win\chromedriver.exe" #使用指定的浏览器驱动-匹配手机上的谷歌浏览器 } driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', des) driver.implicitly_wait(5) driver.get('http://hao.uc.cn/') #打开UC网页
报错如下:
selenium.common.exceptions.WebDriverException:
Message: An unkNown server-side error occurred while processing the command. Original error: Can't stop process;
it's not currently running (cmd: ''C:/Program Files/Appium/resources/app/node_modules/appium/node_modules/appium-chromedriver/chromedriver/win/chromedriver.exe' --url-base\=wd/hub --port\=8001 --adb-port\=5037 --verbose')
原因
折腾了相当久 ,两个晚上 才找到原因,代码没有问题,问题出在浏览器版本与chromedriver版本不一致导致的
解决办法
下载与浏览器版本一致的驱动后,再次启动就成功了。
对应浏览器版本的Chromedriver下载地址:https://npm.taobao.org/mirrors/chromedriver
chromedriver版本匹配地址:https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/web/chromedriver.md
appium启动服务,链接app报错elenium.common.exceptions.WebDriverException: Message: An unknown server-side erro
selenium.common.exceptions.WebDriverException: Message: An unkNown server-side error occurred while processing the command.
Original error: Error executing adbExec. Original error: 'Command 'D:\\tools\\Android\\android_sdk\\platform-tools\\adb.exe -P 5037 -s 3EP7N19314001798 shell
pm install -g /data/local/tmp/appium_cache/3d97225b036c28750562ef8962defee6b1af19a4.apk' exited with code 1'; Stderr: ''; Code: '1'
desired_caps = {
"automationName":"UiAutomator2",#使用哪个自动化引擎,appium1.x可以不用写
"platformName":"Android",#使用哪个移动操作系统平台
"platformVersion":'9',#移动操作系统版本
"deviceName":"3EP7N19314001798",#使用的移动设备或模拟器的种类,需要在cmd命令下,敲adb devices查看
"appPackage":"com.ulic.misp.asp",#所要测试的app的包名,获取命令:aapt dump badging apk路径,查看package: name=
"appActivity":"com.ulic.misp.asp.ui.loading.GuideActivity",#所要测试app的入口页面,获取命令:aapt dump badging apk路径,查看launchable-activity: name='
"noreset":True#在此会话之前,请勿重置应用程序状态
}
driver= webdriver.Remote("http://127.0.0.1:4723/wd/hub", desired_caps)
查看报错,appium无法清除应用缓存
1、重启下appinum
2、检查下开发者选项中的配置
Phantomjs Selenium WebDriver中的自定义标头
根据这个,现在可以修改标题。Atm我需要在PhantomJS
webdriver中修改Accept-Language。此代码不起作用
DesiredCapabilities.PHANTOMJS['phantomjs.page.customHeaders.Accept-Language'] = 'ru-RU'
driver = webdriver.PhantomJS()
是否可以通过某种方式将Phantomjs配置为发送我的标头?我不在乎:在ghostdriver,phantomjs或phantomjs-
webdriver中。
ruby – 在selenium webdriver中使用带有phantomjs的代理
我在Firefox上看到了一些例子,我用这个浏览器成功地完成了它.我用过这段代码:
profile = Selenium::WebDriver::Firefox::Profile.new profile.proxy = Selenium::WebDriver::Proxy.new :ssl => 'chronos.landebitel.local:3128' $browser = Watir::browser.new :firefox,:profile => profile
但我找不到任何phantomjs的例子.我搜索并尝试了许多解决方案,但都没有效果.
有人可以举个例子来帮助我吗?
解决方法
Watir::browser.new( :phantomjs,args: '--proxy=localhost:8181' )
今天关于PhantomJS在Selenium上意外退出:WebDriverException,状态码为127和selenium 退出的分享就到这里,希望大家有所收获,若想了解更多关于appium 报错:selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occu、appium启动服务,链接app报错elenium.common.exceptions.WebDriverException: Message: An unknown server-side erro、Phantomjs Selenium WebDriver中的自定义标头、ruby – 在selenium webdriver中使用带有phantomjs的代理等相关知识,可以在本站进行查询。
本文标签: