How do you useSelenium's webdriver if you're on already using it through a browser?
I'm getting this error: No such file or directory: 'chromedriver' while trying to run a selenium webdriver script. I have set up a virtual environment on a shared hosting account. My question is do I really need to have Chromedriver installed if I'm using Chrome when executing this script? Or would I have to use something like pyvirtualdisplay to accomplish this?
Here is my code:
#!/home/veloxco/sem.velox.co/serps/venv/bin/python
# -*- coding: UTF-8 -*-
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
print ("Content-Type: text/html; charset=utf-8nn")
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--headless")
driver = webdriver.Chrome(chrome_options=chrome_options executable_path='drivers/chromedriver')
driver.get("http://www.google.com")
print("Chrome Browser Initialized in Headless Mode")
driver.quit()
print("Driver Exited")
I have uploaded Chromedriver.exe onto the web server, but now I'm getting this error:
Traceback (most recent call last):
File "selen.py", line 19, in <module>
driver = webdriver.Chrome(chrome_options=chrome_options,
executable_path='drivers/chromedriver')
File "/home/FILE/PATH/serps/venv/lib/python3.6/site-
packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
self.service.start()
File "/home/FILE/PATH/serps/venv/lib/python3.6/site-
packages/selenium/webdriver/common/service.py", line 76, in start
stdin=PIPE)
File "/usr/local/lib/python3.6/subprocess.py", line 707, in __init__
restore_signals, start_new_session)
File "/usr/local/lib/python3.6/subprocess.py", line 1333, in _execute_child
raise child_exception_type(errno_num, err_msg)
OSError: [Errno 8] Exec format error
Thanks to the help from Davedwards, I uploaded the linux version of chromedriver, and now am receiving this:
Traceback (most recent call last):
File "selen.py", line 20, in <module>
chrome = webdriver.Chrome(options=chrome_options, executable_path="/home/FILE/PATH/serps/drivers/chromedriver")
File "/home/FILE/PATH/serps/venv/lib/python3.6/site-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
self.service.start()
File "/home/FILE/PATH/serps/venv/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 98, in start
self.assert_process_still_running()
File "/home/FILE/PATH/serps/venv/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 111, in assert_process_still_running
% (self.path, return_code)
selenium.common.exceptions.WebDriverException: Message: Service /home/FILE/PATH/serps/drivers/chromedriver unexpectedly exited. Status code was: -11
python selenium-webdriver
|
show 9 more comments
I'm getting this error: No such file or directory: 'chromedriver' while trying to run a selenium webdriver script. I have set up a virtual environment on a shared hosting account. My question is do I really need to have Chromedriver installed if I'm using Chrome when executing this script? Or would I have to use something like pyvirtualdisplay to accomplish this?
Here is my code:
#!/home/veloxco/sem.velox.co/serps/venv/bin/python
# -*- coding: UTF-8 -*-
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
print ("Content-Type: text/html; charset=utf-8nn")
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--headless")
driver = webdriver.Chrome(chrome_options=chrome_options executable_path='drivers/chromedriver')
driver.get("http://www.google.com")
print("Chrome Browser Initialized in Headless Mode")
driver.quit()
print("Driver Exited")
I have uploaded Chromedriver.exe onto the web server, but now I'm getting this error:
Traceback (most recent call last):
File "selen.py", line 19, in <module>
driver = webdriver.Chrome(chrome_options=chrome_options,
executable_path='drivers/chromedriver')
File "/home/FILE/PATH/serps/venv/lib/python3.6/site-
packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
self.service.start()
File "/home/FILE/PATH/serps/venv/lib/python3.6/site-
packages/selenium/webdriver/common/service.py", line 76, in start
stdin=PIPE)
File "/usr/local/lib/python3.6/subprocess.py", line 707, in __init__
restore_signals, start_new_session)
File "/usr/local/lib/python3.6/subprocess.py", line 1333, in _execute_child
raise child_exception_type(errno_num, err_msg)
OSError: [Errno 8] Exec format error
Thanks to the help from Davedwards, I uploaded the linux version of chromedriver, and now am receiving this:
Traceback (most recent call last):
File "selen.py", line 20, in <module>
chrome = webdriver.Chrome(options=chrome_options, executable_path="/home/FILE/PATH/serps/drivers/chromedriver")
File "/home/FILE/PATH/serps/venv/lib/python3.6/site-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
self.service.start()
File "/home/FILE/PATH/serps/venv/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 98, in start
self.assert_process_still_running()
File "/home/FILE/PATH/serps/venv/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 111, in assert_process_still_running
% (self.path, return_code)
selenium.common.exceptions.WebDriverException: Message: Service /home/FILE/PATH/serps/drivers/chromedriver unexpectedly exited. Status code was: -11
python selenium-webdriver
2
When you try to create a browser in selenium you need a browser driver like firefox/chrome/gecko driver. Refer to this repo it contains drivers(old version) and a simple example also. github.com/ozcanyarimdunya/seleniumtest .
– ozcanyarimdunya
Dec 28 '18 at 19:52
1
chromedriver
is not the same as Google Chrome web browser, so if you are running Google Chrome, you still need to installchromedriver.exe
or point your script to its location to do automation within your script.
– davedwards
Dec 28 '18 at 19:53
Ah. That makes more sense! In this case, would I just install chromedriver.exe in the same directory as webdriver?
– StephenB
Dec 28 '18 at 20:06
no that's not necessary, ChromeDriver is a separate executable that WebDriver uses to control Chrome.chromedriver.exe
doesn't get "installed" as traditional programs do, so you only need to download it and point to it's path in your script,driver = webdriver.Chrome('/path/to/chromedriver') # Optional argument, if not specified will search path.
see chromedriver.chromium.org/getting-started
– davedwards
Dec 28 '18 at 20:12
What if I'm running this python script through a website? Would I just upload the .exe somewhere in my files?
– StephenB
Dec 28 '18 at 20:18
|
show 9 more comments
I'm getting this error: No such file or directory: 'chromedriver' while trying to run a selenium webdriver script. I have set up a virtual environment on a shared hosting account. My question is do I really need to have Chromedriver installed if I'm using Chrome when executing this script? Or would I have to use something like pyvirtualdisplay to accomplish this?
Here is my code:
#!/home/veloxco/sem.velox.co/serps/venv/bin/python
# -*- coding: UTF-8 -*-
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
print ("Content-Type: text/html; charset=utf-8nn")
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--headless")
driver = webdriver.Chrome(chrome_options=chrome_options executable_path='drivers/chromedriver')
driver.get("http://www.google.com")
print("Chrome Browser Initialized in Headless Mode")
driver.quit()
print("Driver Exited")
I have uploaded Chromedriver.exe onto the web server, but now I'm getting this error:
Traceback (most recent call last):
File "selen.py", line 19, in <module>
driver = webdriver.Chrome(chrome_options=chrome_options,
executable_path='drivers/chromedriver')
File "/home/FILE/PATH/serps/venv/lib/python3.6/site-
packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
self.service.start()
File "/home/FILE/PATH/serps/venv/lib/python3.6/site-
packages/selenium/webdriver/common/service.py", line 76, in start
stdin=PIPE)
File "/usr/local/lib/python3.6/subprocess.py", line 707, in __init__
restore_signals, start_new_session)
File "/usr/local/lib/python3.6/subprocess.py", line 1333, in _execute_child
raise child_exception_type(errno_num, err_msg)
OSError: [Errno 8] Exec format error
Thanks to the help from Davedwards, I uploaded the linux version of chromedriver, and now am receiving this:
Traceback (most recent call last):
File "selen.py", line 20, in <module>
chrome = webdriver.Chrome(options=chrome_options, executable_path="/home/FILE/PATH/serps/drivers/chromedriver")
File "/home/FILE/PATH/serps/venv/lib/python3.6/site-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
self.service.start()
File "/home/FILE/PATH/serps/venv/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 98, in start
self.assert_process_still_running()
File "/home/FILE/PATH/serps/venv/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 111, in assert_process_still_running
% (self.path, return_code)
selenium.common.exceptions.WebDriverException: Message: Service /home/FILE/PATH/serps/drivers/chromedriver unexpectedly exited. Status code was: -11
python selenium-webdriver
I'm getting this error: No such file or directory: 'chromedriver' while trying to run a selenium webdriver script. I have set up a virtual environment on a shared hosting account. My question is do I really need to have Chromedriver installed if I'm using Chrome when executing this script? Or would I have to use something like pyvirtualdisplay to accomplish this?
Here is my code:
#!/home/veloxco/sem.velox.co/serps/venv/bin/python
# -*- coding: UTF-8 -*-
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
print ("Content-Type: text/html; charset=utf-8nn")
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--headless")
driver = webdriver.Chrome(chrome_options=chrome_options executable_path='drivers/chromedriver')
driver.get("http://www.google.com")
print("Chrome Browser Initialized in Headless Mode")
driver.quit()
print("Driver Exited")
I have uploaded Chromedriver.exe onto the web server, but now I'm getting this error:
Traceback (most recent call last):
File "selen.py", line 19, in <module>
driver = webdriver.Chrome(chrome_options=chrome_options,
executable_path='drivers/chromedriver')
File "/home/FILE/PATH/serps/venv/lib/python3.6/site-
packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
self.service.start()
File "/home/FILE/PATH/serps/venv/lib/python3.6/site-
packages/selenium/webdriver/common/service.py", line 76, in start
stdin=PIPE)
File "/usr/local/lib/python3.6/subprocess.py", line 707, in __init__
restore_signals, start_new_session)
File "/usr/local/lib/python3.6/subprocess.py", line 1333, in _execute_child
raise child_exception_type(errno_num, err_msg)
OSError: [Errno 8] Exec format error
Thanks to the help from Davedwards, I uploaded the linux version of chromedriver, and now am receiving this:
Traceback (most recent call last):
File "selen.py", line 20, in <module>
chrome = webdriver.Chrome(options=chrome_options, executable_path="/home/FILE/PATH/serps/drivers/chromedriver")
File "/home/FILE/PATH/serps/venv/lib/python3.6/site-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
self.service.start()
File "/home/FILE/PATH/serps/venv/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 98, in start
self.assert_process_still_running()
File "/home/FILE/PATH/serps/venv/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 111, in assert_process_still_running
% (self.path, return_code)
selenium.common.exceptions.WebDriverException: Message: Service /home/FILE/PATH/serps/drivers/chromedriver unexpectedly exited. Status code was: -11
python selenium-webdriver
python selenium-webdriver
edited Dec 28 '18 at 21:36
StephenB
asked Dec 28 '18 at 19:48
StephenBStephenB
74111
74111
2
When you try to create a browser in selenium you need a browser driver like firefox/chrome/gecko driver. Refer to this repo it contains drivers(old version) and a simple example also. github.com/ozcanyarimdunya/seleniumtest .
– ozcanyarimdunya
Dec 28 '18 at 19:52
1
chromedriver
is not the same as Google Chrome web browser, so if you are running Google Chrome, you still need to installchromedriver.exe
or point your script to its location to do automation within your script.
– davedwards
Dec 28 '18 at 19:53
Ah. That makes more sense! In this case, would I just install chromedriver.exe in the same directory as webdriver?
– StephenB
Dec 28 '18 at 20:06
no that's not necessary, ChromeDriver is a separate executable that WebDriver uses to control Chrome.chromedriver.exe
doesn't get "installed" as traditional programs do, so you only need to download it and point to it's path in your script,driver = webdriver.Chrome('/path/to/chromedriver') # Optional argument, if not specified will search path.
see chromedriver.chromium.org/getting-started
– davedwards
Dec 28 '18 at 20:12
What if I'm running this python script through a website? Would I just upload the .exe somewhere in my files?
– StephenB
Dec 28 '18 at 20:18
|
show 9 more comments
2
When you try to create a browser in selenium you need a browser driver like firefox/chrome/gecko driver. Refer to this repo it contains drivers(old version) and a simple example also. github.com/ozcanyarimdunya/seleniumtest .
– ozcanyarimdunya
Dec 28 '18 at 19:52
1
chromedriver
is not the same as Google Chrome web browser, so if you are running Google Chrome, you still need to installchromedriver.exe
or point your script to its location to do automation within your script.
– davedwards
Dec 28 '18 at 19:53
Ah. That makes more sense! In this case, would I just install chromedriver.exe in the same directory as webdriver?
– StephenB
Dec 28 '18 at 20:06
no that's not necessary, ChromeDriver is a separate executable that WebDriver uses to control Chrome.chromedriver.exe
doesn't get "installed" as traditional programs do, so you only need to download it and point to it's path in your script,driver = webdriver.Chrome('/path/to/chromedriver') # Optional argument, if not specified will search path.
see chromedriver.chromium.org/getting-started
– davedwards
Dec 28 '18 at 20:12
What if I'm running this python script through a website? Would I just upload the .exe somewhere in my files?
– StephenB
Dec 28 '18 at 20:18
2
2
When you try to create a browser in selenium you need a browser driver like firefox/chrome/gecko driver. Refer to this repo it contains drivers(old version) and a simple example also. github.com/ozcanyarimdunya/seleniumtest .
– ozcanyarimdunya
Dec 28 '18 at 19:52
When you try to create a browser in selenium you need a browser driver like firefox/chrome/gecko driver. Refer to this repo it contains drivers(old version) and a simple example also. github.com/ozcanyarimdunya/seleniumtest .
– ozcanyarimdunya
Dec 28 '18 at 19:52
1
1
chromedriver
is not the same as Google Chrome web browser, so if you are running Google Chrome, you still need to install chromedriver.exe
or point your script to its location to do automation within your script.– davedwards
Dec 28 '18 at 19:53
chromedriver
is not the same as Google Chrome web browser, so if you are running Google Chrome, you still need to install chromedriver.exe
or point your script to its location to do automation within your script.– davedwards
Dec 28 '18 at 19:53
Ah. That makes more sense! In this case, would I just install chromedriver.exe in the same directory as webdriver?
– StephenB
Dec 28 '18 at 20:06
Ah. That makes more sense! In this case, would I just install chromedriver.exe in the same directory as webdriver?
– StephenB
Dec 28 '18 at 20:06
no that's not necessary, ChromeDriver is a separate executable that WebDriver uses to control Chrome.
chromedriver.exe
doesn't get "installed" as traditional programs do, so you only need to download it and point to it's path in your script, driver = webdriver.Chrome('/path/to/chromedriver') # Optional argument, if not specified will search path.
see chromedriver.chromium.org/getting-started– davedwards
Dec 28 '18 at 20:12
no that's not necessary, ChromeDriver is a separate executable that WebDriver uses to control Chrome.
chromedriver.exe
doesn't get "installed" as traditional programs do, so you only need to download it and point to it's path in your script, driver = webdriver.Chrome('/path/to/chromedriver') # Optional argument, if not specified will search path.
see chromedriver.chromium.org/getting-started– davedwards
Dec 28 '18 at 20:12
What if I'm running this python script through a website? Would I just upload the .exe somewhere in my files?
– StephenB
Dec 28 '18 at 20:18
What if I'm running this python script through a website? Would I just upload the .exe somewhere in my files?
– StephenB
Dec 28 '18 at 20:18
|
show 9 more comments
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53963638%2fhow-do-you-useseleniums-webdriver-if-youre-on-already-using-it-through-a-brows%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53963638%2fhow-do-you-useseleniums-webdriver-if-youre-on-already-using-it-through-a-brows%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
When you try to create a browser in selenium you need a browser driver like firefox/chrome/gecko driver. Refer to this repo it contains drivers(old version) and a simple example also. github.com/ozcanyarimdunya/seleniumtest .
– ozcanyarimdunya
Dec 28 '18 at 19:52
1
chromedriver
is not the same as Google Chrome web browser, so if you are running Google Chrome, you still need to installchromedriver.exe
or point your script to its location to do automation within your script.– davedwards
Dec 28 '18 at 19:53
Ah. That makes more sense! In this case, would I just install chromedriver.exe in the same directory as webdriver?
– StephenB
Dec 28 '18 at 20:06
no that's not necessary, ChromeDriver is a separate executable that WebDriver uses to control Chrome.
chromedriver.exe
doesn't get "installed" as traditional programs do, so you only need to download it and point to it's path in your script,driver = webdriver.Chrome('/path/to/chromedriver') # Optional argument, if not specified will search path.
see chromedriver.chromium.org/getting-started– davedwards
Dec 28 '18 at 20:12
What if I'm running this python script through a website? Would I just upload the .exe somewhere in my files?
– StephenB
Dec 28 '18 at 20:18