I am trying to execute python selenium tests on a linux vm. I am using webdriver-manager to automatically select the right edge driver. However, this is what my error looks like:
Exception has occurred: WebDriverException
Message: unknown error: Microsoft Edge failed to start: exited abnormally.
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from msedge location /usr/bin/microsoft-edge is no longer running, so msedgedriver is assuming that msedge has crashed.)
Whats the reason behind this error? How can I fix it? Thanks for your help!
Code:
import os
import time
from selenium import webdriver
from selenium.webdriver.edge.service import Service as EdgeService
from webdriver_manager.microsoft import EdgeChromiumDriverManager
driver = webdriver.Edge(service=EdgeService(EdgeChromiumDriverManager().install()))
base_url = "http://localhost:5000/"
driver.get(base_url)
Related
I want to test a localhost app with a selenium script that is executed on a linux VM. No matter whether I try with a manually added webdriver or the webdriver-manager it says "selenium.common.exceptions.WebDriverException: Message: 'msedgedriver' executable needs to be in PATH."
Any ideas how to fix that? Thanks for your help!
Of course, I skimmed stackoverflow for similiar questions - and there are plenty, but it still doesnt work here. The other error I receive from time to time is: selenium.common.exceptions.WebDriverException: Message: unknown error: Microsoft Edge failed to start: exited abnormally.
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from msedge location /usr/bin/microsoft-edge is no longer running, so msedgedriver is assuming that msedge has crashed.)
import os
from selenium import webdriver
from selenium.webdriver.edge.service import Service as EdgeService
from webdriver_manager.microsoft import EdgeChromiumDriverManager
os.environ['PATH'] += r"msedgedriver.exe"
# #Suppress irrelevant error messages
options = webdriver.EdgeOptions()
options.add_experimental_option('excludeSwitches', ['enable-logging'])
driver = webdriver.Edge(options=options)
#driver = webdriver.Edge(service=EdgeService(EdgeChromiumDriverManager(options=options).install()))
base_url = "http://localhost:5000/"
driver.get(base_url)
I am trying to run some tests in Docker using chromedriver and chrome in Python.
chrome_options = Options()
chrome_options.add_argument('--headless')
However, I used the add_argument('--headless') I have a returning error : Engine not supported, Your version currently configured does not support this"
But, if I do not used the add_argument('--headless'), I received this error:
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally. (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Any tip?
I am trying to package the following Python code into an executable file using PyInstaller:
import pandas as pd
import teradatasql
with teradatasql.connect(host='abcdxxx', user='abcdxxx', password='abcdxxx') as connect:
query = "SHOW TABLE AdventureWorksDW.DimAccount"
df = pd.read_sql(query, connect)
print(df)
When I run the .exe file, it gives me the error:
PyInstallerImportError: Failed to load dynlib/dll
'C:\\Users\\GAX~1.P\\AppData\\Local\\Temp\\_MEI153202\\teradatasql\\teradatasql.dll'.
Most likely this dynlib/dll was not found when the application was frozen.
[9924] Failed to execute script 'hello' due to unhandled exception!
I tried to make the following changes to the .spec file:
b = [
('C:\Users\Path_to_Python\Python\Python310\Lib\site-
packages\teradatasql\teradatasql.dll', '.\\teradatasql')
]
a = Analysis(['hello.py'],
pathex=[],
binaries=b,
datas=[] # , .....
)
But it doesn't resolve the problem. How to fix this?
We provide an article explaining how to include the Teradata SQL Driver for Python into an application packaged by PyInstaller:
https://support.teradata.com/community?id=community_blog&sys_id=c327eac51b1e9c103b00bbb1cd4bcb37
This question already has answers here:
WebDriverException: unknown error: DevToolsActivePort file doesn't exist while trying to initiate Chrome Browser
(44 answers)
Selenium: WebDriverException:Chrome failed to start: crashed as google-chrome is no longer running so ChromeDriver is assuming that Chrome has crashed
(22 answers)
Closed 2 years ago.
I have spent hours on this error. tried all the given solutions and still have the following error :
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally.
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
I have a linux/centos7 - I am using ssh putty to connect the serveur.
I have
google-chrome --version
Google Chrome 85.0.4183.102
chromedriver -v
ChromeDriver 85.0.4183.87
Here is my code
#!/usr/bin/python3.6
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
url='https://www.google.com'
option = webdriver.ChromeOptions()
option.add_argument('–-no-sandbox')
option.add_argument('–-headless')
option.add_argument("--disable-extensions")
driver = webdriver.Chrome(chrome_options=option)
driver.get(url)
print(driver.page_source)
driver.quit()
I have also tried with
#!/usr/bin/python3.6
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from pyvirtualdisplay import Display
display = Display(visible=0, size=(1024, 768))
display.start()
driver = webdriver.Chrome()
url='https://www.google.com'
driver.get(url)
print(driver.page_source)
driver.quit()
and still have the same error. Through ssh I have tried as root and non-root user but still the same..
As information, when doing
google-chrome --no-sandbox : gives :
[4463:4463:0919/160950.452059:ERROR:browser_main_loop.cc(1417)] Unable to open X display.
[root#ns344379 mail_from_any_webpage]# [0919/160950.501241:ERROR:nacl_helper_linux.cc(308)] NaCl helper process running without a sandbox!
Most likely you need to configure your SUID sandbox correctly
[0919/160950.501399:ERROR:nacl_helper_linux.cc(308)] NaCl helper process running without a sandbox!
Most likely you need to configure your SUID sandbox correctly
and I add that I had installed google-chrome successfully but I had an error message while installation : "Redirecting to /bin/systemctl start atd.service
Failed to start atd.service: Unit not found." (I am under plesk)
Running transaction
Installation : google-chrome-stable-85.0.4183.102-1.x86_64 1/1
Redirecting to /bin/systemctl start atd.service
Failed to start atd.service: Unit not found.
Vérification : google-chrome-stable-85.0.4183.102-1.x86_64 1/1
Installé :
google-chrome-stable.x86_64 0:85.0.4183.102-1
Terminé !
I'm trying to get the current page url on my Opera GX browser, but I can't find if there is a way to do it. I thought selenium might work, but when I run my code, it gives me this in the command prompt:
[12252:21468:0914/190450.397:ERROR:CONSOLE(0)] "Unchecked runtime.lastError: Could not establish connection. Receiving end does not exist.", source: chrome://startpage/ (0)
The output error in the python IDE is this one:
selenium.common.exceptions.WebDriverException: Message: unknown error: Opera failed to start: exited normally.
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from opera location C:/Users/remis/AppData/Local/Programs/Opera GX/launcher.exe is no longer running, so OperaDriver is assuming that Opera has crashed.)
(Driver info: operadriver=84.0.4147.89 (19abfe7bcba9318a0b2a6bc6634a67fc834aa592-refs/branch-heads/4147#{#852}),platform=Windows NT 10.0.18363 x86_64)
Here is my code:
from selenium import webdriver
from selenium.webdriver.opera.options import Options
import time
options = Options()
options.binary_location = "C:/Users/remis/AppData/Local/Programs/Opera GX/launcher.exe"
driver = webdriver.Opera(executable_path="C:/Users/remis/PycharmProjects/FormationChecker/operadriver_win64/operadriver.exe", options = options)
print(driver.current_url)
time.sleep(1)
I'm very new to selenium and this is just a very simple test. I hope someone can help me with this.