Error while open browser from selenium - python-3.x

my script
from selenium import webdriver
o = webdriver.Firefox()
and i get this problem
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/firefox/webdriver.py", line 142, in __init__
self.service.start()
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/common/service.py", line 74, in start
stdout=self.log_file, stderr=self.log_file)
File "/usr/lib/python3.5/subprocess.py", line 676, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.5/subprocess.py", line 1283, in _execute_child
raise child_exception_type(errno_num, err_msg)
OSError: [Errno 8] Exec format error
i searched on it and i found this
OSError: [Errno 8] Exec format error selenium
i get chromedriver and put it in '/usr/local/bin/'
like supposed,
it doesn't help
and also did the same thing with geckodriver
Trouble setting up selenium with python3(linux)
nothing work same error
and i try this shot
#!usr/bin/python
#!/usr/bin/env bash
from selenium import webdriver
web = webdriver.Firefox(executable_path="/usr/local/bin/chromedriver")
it give me that error :
Traceback (most recent call last):
File "/root/Desktop/test.py", line 5, in <module>
web = webdriver.Firefox(executable_path="/usr/local/bin/chromedriver")
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/firefox/webdriver.py", line 142, in __init__
self.service.start()
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/common/service.py", line 96, in start
self.assert_process_still_running()
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/common/service.py", line 109, in assert_process_still_running
% (self.path, return_code)
selenium.common.exceptions.WebDriverException: Message: Service /usr/local/bin/chromedriver unexpectedly exited. Status code was: 1
Note :
operation system is kali linux
SMP Debian 4.9.18-1kali1 version,
firefox and selenium is up to date

driver should be updated one & did u try webdriver.Firefox(driver_path) ?

Uninstall instance of webdriver dependency and install the correct one which corresponds to your OS and browser version.Also when you give path of chrome ,it should end with chrome.exe and not chrome.

Related

Two errors when trying to open firefox using selenium (Python); System cannot find the file specified; Geckodriver executable needs to be in PATH

import time
from selenium import webdriver
path = input("enter filepath: ")
driver = webdriver.Firefox(path)
driver.get("htpps://google.com")
This is the part of my code seemingly causing the error, I have been able to find any answers online. The code used to work when using r"c:\users\ellio\desktop\main" however this has since stopped working too, only without the top error. I have added the folder containg geckodriver to path and added the geckodriver exe to the same file as my code, but nothing seems to work.
Thanks in advance for any help.
Here are the errors
Traceback (most recent call last):
File "C:\Users\ellio\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\common\service.py", line 72, in start
self.process = subprocess.Popen(cmd, env=self.env,
File "C:\Users\ellio\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\ellio\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 1420, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\Users\ellio\Desktop\main\app.py", line 18, in <module>
driver = webdriver.Firefox(path)
File "C:\Users\ellio\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 164, in __init__
self.service.start()
File "C:\Users\ellio\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start
raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.
give a specific path of your driver
from selenium import webdriver
driver = webdriver.Chrome('D:\\chrome\\chromedriver.exe') #give location of driver you download
driver.get('http://www.google.com/');
time.sleep(5)
search_box = driver.find_element_by_name('q')
search_box.send_keys('ChromeDriver')
search_box.submit()
time.sleep(5)
driver.quit()

getting "selenium.common.exceptions.SessionNotCreatedExceptionSelenium" error using InstaPy

[SETUP:
Windows 10 x64
PyCharm 2019.3.3 (Community Edition)]
I'm trying to create a simple Insta bot with InstaPy but I keep running into the same error
CODE:
from instapy import InstaPy
InstaPy(username='username', password='password').login()
I keep getting the following error:
Traceback (most recent call last):
File "C:/Users/Niku/PycharmProjects/InstaBot/InstaBot.py", line 6, in <module>
InstaPy(username='Rubixmusicprod', password='Niku2020').login()
File "C:\Users\Niku\PycharmProjects\InstaBot\venv\lib\site-packages\instapy\instapy.py", line 309, in __init__
self.browser, err_msg = set_selenium_local_session(
File "C:\Users\Niku\PycharmProjects\InstaBot\venv\lib\site-packages\instapy\browser.py", line 111, in set_selenium_local_session
browser = webdriver.Firefox(
File "C:\Users\Niku\PycharmProjects\InstaBot\venv\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 170, in __init__
RemoteWebDriver.__init__(
File "C:\Users\Niku\PycharmProjects\InstaBot\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "C:\Users\Niku\PycharmProjects\InstaBot\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:\Users\Niku\PycharmProjects\InstaBot\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\Niku\PycharmProjects\InstaBot\venv\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: Unable to find a matching set of capabilities
I've tried upgrading selenium, along with Geckodriver and related drivers.
It was a mission just to get InstaPy installed!
I may just have to go the browser automation way instead here.
Any help would be greatly appreciated!!
You must use Selenium with Geckodrive in Firefox
session = InstaPy(username=INSTAGRAM_LOGIN,
password=INSTAGRAM_PASSWORD,
geckodriver_path='geckodriver.exe')

Cant start docker `OSError: [Errno 8] Exec format error: '/usr/local/bin/docker-credential-ecr-login'`

I want to start my docker-compose and I always get this error.
Docker Desktop tells me I'm logged in. I also rebooted once and logged in again.
I don't quite understand why that's not possible. If I pull other Docker Containers in another project, everything works.
We dont use paython in our project.
$ docker --version
Docker version 19.03.8, build afacb8b
$ docker-compose --version
docker-compose version 1.25.4, build 8d51620a
$ python --version
Python 3.7.4
macOS Catalina 10.15.3
Here is the stacktrace
> docker-compose up
Pulling mongo (mongo:latest)...
Traceback (most recent call last):
File "site-packages/docker/credentials/store.py", line 80, in _execute
File "subprocess.py", line 411, in check_output
File "subprocess.py", line 488, in run
File "subprocess.py", line 800, in __init__
File "subprocess.py", line 1551, in _execute_child
OSError: [Errno 8] Exec format error: '/usr/local/bin/docker-credential-ecr-login'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "site-packages/docker/auth.py", line 264, in _resolve_authconfig_credstore
File "site-packages/docker/credentials/store.py", line 35, in get
File "site-packages/docker/credentials/store.py", line 104, in _execute
docker.credentials.errors.StoreError: Unexpected OS error "Exec format error", errno=8
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "docker-compose", line 6, in <module>
File "compose/cli/main.py", line 72, in main
File "compose/cli/main.py", line 128, in perform_command
File "compose/cli/main.py", line 1077, in up
File "compose/cli/main.py", line 1073, in up
File "compose/project.py", line 548, in up
File "compose/service.py", line 361, in ensure_image_exists
File "compose/service.py", line 1250, in pull
File "compose/progress_stream.py", line 102, in get_digest_from_pull
File "compose/service.py", line 1215, in _do_pull
File "site-packages/docker/api/image.py", line 396, in pull
File "site-packages/docker/auth.py", line 48, in get_config_header
File "site-packages/docker/auth.py", line 324, in resolve_authconfig
File "site-packages/docker/auth.py", line 235, in resolve_authconfig
File "site-packages/docker/auth.py", line 281, in _resolve_authconfig_credstore
docker.errors.DockerException: Credentials store error: StoreError('Unexpected OS error "Exec format error", errno=8')
[52557] Failed to execute script docker-compose
resetting the docker in docker-hub/settings solved the problem.

Mac: saving .exe to PATH for selenium web driver

I am not a professional developer... trying to save chromedriver to PATH variable so i can use selenium with python.
following this page for instructions on this page
https://medium.com/#himanshuagarwal1395/setting-up-environment-variables-in-macos-sierra-f5978369b255
I open bash_profile with nano .bash_profile
I made a directory user/mysusername/selenium/
then saved my file chromedriver in this directory with the python script i and using selenium with.
I have tried to save my path to the chromedriver.exe file as such
export PATH="/User/baldoa/selenium/ChromeDriver.exe:$PATH"
I follow the steps to save appropriately according to this page. I am not sure
i still get the following error :
a8206602016e:selenium baldoa$ python destruction.py
Traceback (most recent call last):
File "/Users/baldoa/.pyenv/versions/3.6.5/lib/python3.6/site-packages/selenium
/webdriver/common/service.py", line 76, in start
stdin=PIPE)
File "/Users/baldoa/.pyenv/versions/3.6.5/lib/python3.6/subprocess.py", line
709, in __init__
restore_signals, start_new_session)
File "/Users/baldoa/.pyenv/versions/3.6.5/lib/python3.6/subprocess.py", line
1344, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'C:/users/baldoa
/selenium/chromedriver.exe': 'C:/users/baldoa/selenium/chromedriver.exe'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "destruction.py", line 7, in <module>
browser = webdriver.Chrome("""C:/users/baldoa/selenium/chromedriver.exe""")
File "/Users/baldoa/.pyenv/versions/3.6.5/lib/python3.6/site-packages/selenium
/webdriver/chrome/webdriver.py", line 68, in __init__
self.service.start()
File "/Users/baldoa/.pyenv/versions/3.6.5/lib/python3.6/site-packages/selenium
/webdriver/common/service.py", line 83, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver.exe'
executable needs to be in PATH. Please see https://sites.google.com
/a/chromium.org/chromedriver/home

webrtc build fail in ubuntu

I built webrtc for my linux (ubuntu 14.04 32 bit) machine. The way I follow to build webrtc is following.
1, download and setup depot_tools and java.
2, fetch webrtc.
3, build/install-build-deps.sh.
4, export GYP_GENERATORS=make.
5, gclient runhooks --force (also try python src/webrtc/build/gyp_webrtc).
6, make.
when make command execute after compile some code following error occur.
LINK(host) out/Debug/protoc
TOUCH webrtc_modules_modules_gyp_audioproc_debug_proto_target_genproto_0.intermediate
RULE webrtc_modules_modules_gyp_audioproc_debug_proto_target_genproto_0
webrtc_modules_modules_gyp_audioproc_debug_proto_target_genproto_0.intermediate
Traceback (most recent call last):
File "../../tools/protoc_wrapper/protoc_wrapper.py", line 134, in <module>
sys.exit(main(sys.argv))
File "../../tools/protoc_wrapper/protoc_wrapper.py", line 119, in main
ret = subprocess.call(protoc_args)
File "/usr/lib/python2.7/subprocess.py", line 522, in call
return Popen(*popenargs, **kwargs).wait()
File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
make: *** [webrtc_modules_modules_gyp_audioproc_debug_proto_target_genproto_0.intermediate]
Error 1
rm webrtc_modules_modules_gyp_audioproc_debug_proto_target_genproto_0.intermediate.
Do you guys have any idea of why? And how to fix this?

Resources