selenium.common.exceptions.WebDriverException: Message: Service - google-chrome

I had a trouble when i use selenium to control my Chrome.
Here is my code:
from selenium import webdriver
driver = webdriver.Chrome()
When i tried to operate it ,it runs successfully at first,the Chrome pop on the screen. However, it shut down at the few seconds.
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
driver = webdriver.Chrome('C:\Program Files (x86)\Google\Chrome\chrome.exe')
File "C:\Users\35273\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 62, in __init__
self.service.start()
File "C:\Users\35273\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\common\service.py", line 86, in start
self.assert_process_still_running()
File "C:\Users\35273\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\common\service.py", line 99, in assert_process_still_running
% (self.path, return_code)
selenium.common.exceptions.WebDriverException: Message: Service C:\Program Files (x86)\Google\Chrome\chrome.exe unexpectedly exited. Status code was: 0

You need to provide the path of chromedriver...download from http://chromedriver.storage.googleapis.com/index.html?path=2.24/...unzip it and provide path to it in... webdriver.chrome ("path to chromedriver")
I explain the things here:
from selenium import webdriver
driver = webdriver.Chrome("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe")
This is the error if i run the above code:
C:\Python27\python.exe C:/Users/Gaurav.Gaurav-PC/PycharmProjects/Learning/StackOverflow/SeleniumQuestion/test123.py
Traceback (most recent call last):
File "C:/Users/Gaurav.Gaurav-PC/PycharmProjects/Learning/StackOverflow/SeleniumQuestion/test123.py", line 4, in <module>
driver = webdriver.Chrome("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe")
File "C:\Python27\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 62, in __init__
self.service.start()
File "C:\Python27\lib\site-packages\selenium\webdriver\common\service.py", line 86, in start
self.assert_process_still_running()
File "C:\Python27\lib\site-packages\selenium\webdriver\common\service.py", line 99, in assert_process_still_running
% (self.path, return_code)
selenium.common.exceptions.WebDriverException: Message: Service C:\Program Files (x86)\Google
\Chrome\Application\chrome.exe unexpectedly exited. Status code was: 0
Which is same as mentioned by #Weiziyoung in original problem.
The solution is as I mentioned you need to provide the path to chromedriver in place of chrome browser like
driver = webdriver.Chrome("E:\Jars\chromedriver.exe")
It will resolve the problem

Download the appropriate driver:http://chromedriver.storage.googleapis.com/index.html
turn up E:\Python37\Scripts <--Paste the chromedriver.exe file in

i faced the same error (behave.step_registry.AmbiguousStep: #given('Lunch chrome Browser') has already been defined in existing step #given('Lunch chrome Browser') at features/steps/OrangeHRMlogin.py:4). i think it takes previous program where it mentioned "Lunch chrome browser". so i did some changes like in 2nd program i cahnged at (U'chrome browser').change the browser name or the Phase and it runs successfully.

the original chrome browser is opened instead of chrome driver that's the reason of that error download chrome driver and give it's path

Related

Failed to create GLFW Window while trying to run Mujoco (UBUNTU)

So, I am trying to install, and run Mujoco-py on my ubuntu. Everything went well but, I cant install the libglew1.5. I searche for it in the Ubuntu Package Archives, but no luck. Then I skipped that part, but when im trying to run the example its giving me this error.
(mujoco_py) user#user:~/.mujoco/mujoco-py/examples$ python3 setting_state.py
Creating window glfw
libEGL warning: MESA-LOADER: failed to open iris: /usr/lib/dri/iris_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
libEGL warning: MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
GLFW error (code %d): %s 65542 b'EGL: Failed to initialize EGL: EGL is not or could not be initialized'
Traceback (most recent call last):
File "setting_state.py", line 32, in <module>
viewer = MjViewer(sim)
File "/home/sazzad14/.mujoco/mujoco-py/mujoco_py/mjviewer.py", line 137, in __init__
super().__init__(sim)
File "/home/sazzad14/.mujoco/mujoco-py/mujoco_py/mjviewer.py", line 28, in __init__
super().__init__(sim)
File "mjrendercontext.pyx", line 311, in mujoco_py.cymj.MjRenderContextWindow.__init__
File "mjrendercontext.pyx", line 46, in mujoco_py.cymj.MjRenderContext.__init__
File "mjrendercontext.pyx", line 102, in mujoco_py.cymj.MjRenderContext._setup_opengl_context
File "opengl_context.pyx", line 48, in mujoco_py.cymj.GlfwContext.__init__
File "opengl_context.pyx", line 99, in mujoco_py.cymj.GlfwContext._create_window
mujoco_py.cymj.GlfwError: Failed to create GLFW window
I installed libglew2.2, but that does not help.

Java heap space error in TypeDB when importing CSV files

I tried to import some CSV files into my TypeDB schema using Python and got the following error.
Traceback (most recent call last):
File "C:\Users\panxx006\Desktop\test\migrate.py", line 65, in <module>
build_test_graph(inputs=inputs)
File "C:\Users\panxx006\Desktop\test\migrate.py", line 9, in build_test_graph
load_data_into_typedb(input, session)
File "C:\Users\panxx006\Desktop\test\migrate.py", line 21, in load_data_into_typedb
transaction.commit()
File "C:\Users\panxx006\AppData\Local\Programs\Python\Python39\lib\site-packages\typedb\connection\transaction.py", line 95, in commit
self.execute(transaction_commit_req())
File "C:\Users\panxx006\AppData\Local\Programs\Python\Python39\lib\site-packages\typedb\connection\transaction.py", line 80, in execute
return self.run_query(request, batch).get()
File "C:\Users\panxx006\AppData\Local\Programs\Python\Python39\lib\site-packages\typedb\stream\bidirectional_stream.py", line 136, in get
return self._stream.fetch(self._request_id)
File "C:\Users\panxx006\AppData\Local\Programs\Python\Python39\lib\site-packages\typedb\stream\bidirectional_stream.py", line 84, in fetch
raise error
typedb.common.exception.TypeDBClientException: Java heap space
Please check server logs for the stack trace.
Could you please tell me the way to fix this error? I'm using TypeDB 2.6.3
Upgrading your version of TypeDB to the latest version will help solve this error. As of writing, TypeDB 2.13.0 is the newest version, which includes a number of improvements to memory usage so you should see fewer errors of this kind in the future.
You can download the latest version of TypeDB from the releases page on GitHub: https://github.com/vaticle/typedb/releases
Full disclosure: I work for Vaticle, the creators of TypeDB.

Windows 10 Rtree installation successful from .whl file, but error when running code

I am running Python 3.7, 64bit on Windows 10 and trying desperately to get Rtree running. I use the package Rtree-0.9.1-cp37-cp37m-win_amd64.whl from Christoph Gohlke (https://www.lfd.uci.edu/~gohlke/pythonlibs/).
I have tried for very long to get it to work, but keep on getting the following error message when running a script that uses geopandas.
Traceback (most recent call last):
File "C:\Python37\lib\site-packages\rtree\core.py", line 90, in <module>
rt = ctypes.CDLL(os.path.join(here, 'spatialindex_c.dll'))
File "C:\Python37\lib\ctypes\__init__.py", line 364, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] The specified module could not be found
The installation of the whl-package should include the libspatialindex files, but they are not found when running the code. I tried to use Python 2.7 first to run it, then installed Python 3.7. I've checked all the dependencies and checked whether the "spatialindex_c.dll" files are at the right place, but nothing helps. Would be great to get an answer on that.

Python unable to detect file, throws an error

I run a cocos2dx to generate an APK file, but it throws out this error
BUILD SUCCESSFUL in 7m 49s
54 actionable tasks: 3 executed, 51 up-to-date
Traceback (most recent call last):
File "/cocos2dx/tools/cocos2d-console/bin/cocos.py", line 1072, in <module>
run_plugin(command, argv, plugins)
File "/cocos2dx/tools/cocos2d-console/bin/cocos.py", line 961, in run_plugin
plugin.run(argv, dependencies_objects)
File "/cocos2dx/tools/cocos2d-console/plugins/plugin_compile/project_compile.py", line 1646, in run
self.build_android()
File "/cocos2dx/tools/cocos2d-console/plugins/plugin_compile/project_compile.py", line 581, in build_android
self.apk_path = builder.do_build_apk(build_mode, self._no_apk, output_dir, self._custom_step_args, self._ap, self)
File "/cocos2dx/tools/cocos2d-console/plugins/plugin_compile/build_android.py", line 669, in do_build_apk
shutil.copy(gen_apk_path, output_dir)
File "/usr/lib/python2.7/shutil.py", line 119, in copy
copyfile(src, dst)
File "/usr/lib/python2.7/shutil.py", line 82, in copyfile
with open(src, 'rb') as fsrc:
IOError: [Errno 2] No such file or directory: '/project/Cocos2dx/proj.android-studio/app/build/outputs/apk/Cocos2dx-debug.apk
Any idea what could be the issue?
You should use Android Studio (instead of run the python function to call ANT) to build the project to apk. It's far easier use, trace error and debug.
about your question:
/project/Cocos2dx/proj.android-studio/app/build/outputs/apk/Cocos2dx-debug.apk
this path is belong to project Android Studio. In my experience, when using the cocos console command, it use proj.android instead of proj.android-studio

Error "cannot find Chrome binary" in windows 8 AMD64 while trying to launch selenium web-driver API

I'm currently working with Chrome extension of selenium web-driver in windows 8 AMD64. I got an issue launching Chrome; It gives me this:
Traceback (most recent call last):
File "D:/java/code/SVN/OMC/trunk/Test/Scripts/PMS\elements\UILoader.py", line 164, in __init__
self.driver = webdriver.Chrome(executable_path="F:\\driver\\chromedriver.exe")
File "C:\Python27\lib\site-packages\selenium-2.42.1-py2.7.egg\selenium\webdriver\chrome\webdriver.py", line 65, in __init__
keep_alive=True)
File "C:\Python27\lib\site-packages\selenium-2.42.1-py2.7.egg\selenium\webdriver\remote\webdriver.py", line 73, in __init__
self.start_session(desired_capabilities, browser_profile)
File "C:\Python27\lib\site-packages\selenium-2.42.1-py2.7.egg\selenium\webdriver\remote\webdriver.py", line 121, in start_session
'desiredCapabilities': desired_capabilities,
File "C:\Python27\lib\site-packages\selenium-2.42.1-py2.7.egg\selenium\webdriver\remote\webdriver.py", line 173, in execute
self.error_handler.check_response(response)
File "C:\Python27\lib\site-packages\selenium-2.42.1-py2.7.egg\selenium\webdriver\remote\errorhandler.py", line 164, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: u'unknown error: cannot find Chrome binary\n (Driver info: chromedriver=2.9.248315,platform=Windows NT 6.2 x86_64)'
I also have put IEDriverServer.exe in the same path and it works fine; this path has been added to the system PATH. I also tried to launch it from another computer with windows 7 AMD64 and it works fine there.
I googled a bit and I saw this; but when I checked the path it specified for chrome.exe, I couldn't find the executable file for chrome. I tried to update Google Chrome, but it gave me error code 1.
I also tried this:
opts = webdriver.ChromeOptions()
opts.binary_location(value = "C:\\WebDrivers\\chromedriver.exe")
driver = webdriver.Chrome(chrome_options = opts)
What should I do?
The last line of the error is the important one:
selenium.common.exceptions.WebDriverException: Message: u'unknown error: cannot find Chrome binary\n (Driver info: chromedriver=2.9.248315,platform=Windows NT 6.2 x86_64)'
The ChromeDriver has been found, and it is reporting that it cannot find the chrome browser executable. Make sure that is installed and on the current path. Some additional information is on the Selenium Wiki.
I solved the problem using ChromeOptions; I addressed the chrome's binary file from ProgramFiles directory. This is the code I used:
opts = webdriver.ChromeOptions()
opts.binary_location(value = "C:\\ProgramFiles\\Google\\Chrome\\chrome.exe")
driver = webdriver.Chrome(chrome_options = opts)
for me it was
opts = webdriver.ChromeOptions()
opts.binary_location = "path/to/Chrome.exe"
driver = webdriver.Chrome(chrome_options=opts)
which fixed the problem
you must set the executable_path where you install the chrome,this is ruby style.python may be the same in my opinion.
Selenium::WebDriver::Chrome::Service.executable_path="D:/Program Files (x86)/Chrome/chrome.exe"