How to run selenium python script using chrome browser in ubuntu - selenium-webdriver

I'm getting error like that and i have seen below URL and i don't know how to configure with ubuntu(12.04). I know how to configure chrome web driver with windows. Please see below error if any body knows send me a answer.
Traceback (most recent call last):
in setUp driver = webdriver.Chrome() File "/home/pyd/pydan/venvs/local/lib/python2.7/site- packages/selenium/webdriver/chrome/webdriver.py",
line 60, in __init__ self.service.start() File "/home/pyd/pydan/venvs/local/lib/python2.7/site- packages/selenium/webdriver/chrome/service.py",
line 64, in start and read up at
http://code.google.com/p/selenium/wiki/ChromeDriver")
WebDriverException: Message: 'ChromeDriver executable needs to be available in the path.

If you checkout this link, http://code.google.com/p/selenium/wiki/ChromeDriver,
there is useful info on where to find the chrome binary on Linux. Also, you might want to check your path environmental variable.

Related

driver.get("https://www.python.org") not working

I am trying to learn Selenium with python.
So trying to access a website but it is not working
from selenium import webdriver
driver = webdriver.Chrome(executable_path="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome")
driver.implicitly_wait(5)
driver.maximize_window()
driver.get("https://www.python.org/")
Error in Console:
/usr/local/bin/python3.7 /Users/adeshpande/PycharmProjects/Selenium/Tests/LoginPagesTest.py
Traceback (most recent call last):
File "/Users/adeshpande/PycharmProjects/Selenium/Tests/LoginPagesTest.py", line 6, in <module>
driver = webdriver.Chrome(executable_path="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome")
File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
self.service.start()
File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/common/service.py", line 98, in start
self.assert_process_still_running()
File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/common/service.py", line 111, in assert_process_still_running
% (self.path, return_code)
selenium.common.exceptions.WebDriverException: Message: Service /Applications/Google Chrome.app/Contents/MacOS/Google Chrome unexpectedly exited. Status code was: 0
Your are passing the path to the Chrome Browser in your call webdriver.Chrome.
You should be passing the path to ChromeDriver which is a separate program. You can download it from https://chromedriver.chromium.org
After downloading and installing it, pass the path to where you installed it and you should be good to go!

error while opening tor browser using Python selenium firefoxdriver

i am trying to open tor browser using selenium python
this is the code
from selenium import webdriver
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
import time
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
#path to TOR binary
binary = FirefoxBinary(r'C:\Users\OKILAN\Desktop\Tor
Browser\Browser\firefox.exe')
#path to TOR profile
profile = FirefoxProfile(r'C:\Users\OKILAN\Desktop\Tor
Browser\Browser\TorBrowser\Data\Browser\profile.default')
cap = DesiredCapabilities().FIREFOX
cap["marionette"] = False
driver =webdriver.Firefox(capabilities=cap,firefox_binary=binary,executable_path=r'C:\Users\OKILAN\Desktop\geckodriver.exe')
driver.get("http://stackoverflow.com")
time.sleep(5)
driver.quit()
When i run the code it shows tor failed to start
and i got the below error
Traceback (most recent call last):
File "C:\Users\OKILAN\Desktop\test1.py", line 13, in <module>
driver = webdriver.Firefox(capabilities=cap,firefox_binary=binary,executable_path=r'C:\Users\OKILAN\Desktop\geckodriver.exe')
File "C:\Users\OKILAN\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 191, in __init__
self.binary, timeout)
File "C:\Users\OKILAN\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\firefox\extension_connection.py", line 52, in __init__
self.binary.launch_browser(self.profile, timeout=timeout)
File "C:\Users\OKILAN\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py", line 73, in launch_browser
self._wait_until_connectable(timeout=timeout)
File "C:\Users\OKILAN\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py", line 104, in _wait_until_connectable
"The browser appears to have exited "
selenium.common.exceptions.WebDriverException: Message: The browser appears to have exited before we could connect. If you specified a log_file in the FirefoxBinary constructor, check it for details.
help me to solve this error:-(
You do not need all the binary and profile stuff, to create driver only use this line
driver = webdriver.Firefox(executable_path="C:\\geckodriver.exe")
driver.get("http://stackoverflow.com")
make sure you have downloaded and set geckodriver to environment
1
First download GeckoDriver for Windows, extract it and copy the path
to the folder.
Right-click on My Computer or This PC. Select Properties.
Select
advanced system settings. Click on the Environment Variables button.
From System Variables select PATH. Click on Edit button. Click New
button. Paste the path of GeckoDriver file.

Error in libcloud and vsphere integration

I am using libcloud 1.2.1 with pysphere 0.1.7. I am getting the below error when trying to connect to the ESXi host.
Traceback (most recent call last):
File "", line 1, in
File "/Library/Python/2.7/site-packages/libcloud/compute/drivers/vsphere.py", line 152, in init
port=port, url=url)
File "/Library/Python/2.7/site-packages/libcloud/common/base.py", line 1177, in init
self.connection = self.connectionCls(args, *conn_kwargs)
TypeError: init() got an unexpected keyword argument 'retry_delay'
I am using the below commands to connect to the host.
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
vsphere = get_driver(Provider.VSPHERE)
driver = vsphere(host='',username='username',password='password')
I can do this using pysphere only but not with libcloud. Tried looking on the internet and changing the content of the libraries but in vain. Can anyone help ?
This is a bug in v1.5.0<, there is a committed fix. You can apply the patch manually using git am: https://patch-diff.githubusercontent.com/raw/apache/libcloud/pull/967.patch
Wait for v1.6.0, or install directly from GitHub trunk
pip install git+https://github.com/apache/libcloud.git#trunk#egg=apache-libcloud

GAE error using appcfg after a failure

D:\kubox\python\GAE>appcfg.py rollback D:\kubox\python\GAE\myapp1
Traceback (most recent call last):
File "D:\kubox\python\GAE\appcfg.py", line 77, in <module>
DIR_PATH = get_dir_path(os.path.join('lib', 'ipaddr'))
File "D:\kubox\python\GAE\appcfg.py", line 67, in get_dir_path
'file and %s.' % sibling)
ValueError: Could not determine directory that contains both, this file and lib\
ipaddr.
After a failure deployment, I can't perform the appcfg.py, did I make a wrong syntax?
where did I do wrong?
WIN 7, cmd prompt
Try running appcfg.py from where your GAE SDK is installed.
Usually rollback should suffice, but after a failure in deployment, sometimes the upload doesn't work by default.
As a work around, you can change the app version (app.yaml), and then try deployment, It should go fine.
Next you can log in to your applications dashboard and in versions tab, you can switch the latest version as default one. Your new version should be up and running now.
As a last step you can stop any instances of old version of your app.
Hope this helps

SSL certificates on Google App Engine

I'm having issues getting started using GAE (1.7.6 on OS X 10.6.8 with Python 2.7) and compared to amazon services it is abysmal. However, I would like to at least get the sample app deployed. After working through the other issues I now have a small sample application ready to deploy. When I try to deploy it, I receive an SSL error as follows:
*** Running appcfg.py with the following flags:
--no_cookies --email=mathsboy#gmail.com --passin update
02:15 PM Host: appengine.google.com
02:15 PM Application: tew-helloworld; version: 1
Traceback (most recent call last):
File "google_appengine/appcfg.py", line 171, in <module>
run_file(__file__, globals())
File "google_appengine/appcfg.py", line 167, in run_file
execfile(script_path, globals_)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/appcfg.py", line 4155, in <module>
main(sys.argv)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/appcfg.py", line 4146, in main
result = AppCfgApp(argv).Run()
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/appcfg.py", line 2334, in Run
self.action(self)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/appcfg.py", line 3881, in __call__
return method()
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/appcfg.py", line 2892, in Update
updatecheck.CheckForUpdates()
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/sdk_update_checker.py", line 258, in CheckForUpdates
runtime=runtime))
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/appengine_rpc.py", line 393, in Send
f = self.opener.open(req)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 394, in open
response = self._open(req, data)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 412, in _open
'_open', req)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 372, in _call_chain
result = func(*args)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1207, in https_open
return self.do_open(httplib.HTTPSConnection, req)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/fancy_urllib/fancy_urllib/__init__.py", line 383, in do_open
url_error.reason.args[1])
fancy_urllib.InvalidCertificateException: Host appengine.google.com returned an invalid certificate (_ssl.c:503: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed):
To learn more, see http://code.google.com/appengine/kb/general.html#rpcssl
If deploy fails you might need to 'rollback' manually.
The "Make Symlinks..." menu option can help with command-line work.
*** appcfg.py has finished with exit code 1 ***
There was some advice on this in another thread stating that you would need to remove cacerts.txt, though I am unable to locate this file on OS X. Also, it seems retarded that in order to have the code upload I'd have to delete a cacert text file. But maybe I'm an idiot.
Another problem I'm facing here, is that OS X doesn't work well with GAE due to the difficulty in managing python versions. I've got a total mess on my hands now after installing multiple versions of python, EPD, ActiveState, MacPorts. None of these worked in solving me earlier problems despite assurances they would. It's really pretty appalling that this is the state of google's application management. It just seems like GAE was built by a bunch of guys from mid-90s microsoft....anyone advice on the above issue would be greatly appreciated. Cheers
Fourth line from end in your error. Relevant instructions under the link.
http://code.google.com/appengine/kb/general.html#rpcssl
Make sure (from documentation):
To do this you must have the ssl Python module installed on your system.
Workaround: Use the command line argument --skip_sdk_update_check=yes when you run dev_appserver.py.
I had the same problem and noticed the GUI tool (GoogleAppEngineLauncher) uses --skip_sdk_update_check=yes every time you start an app. This is as of SDK 1.8.7.
The root cause seems to be a known bug in the GAE development server's module whiltelisting system. Even if you have the ssl module installed (as the documentation says is required), ssl relies on _ssl, which is not whitelisted. This is why you can execute import ssl in a regular python shell session with no problem, but get an error when you execute the same line in a GAE app.

Resources