I tried to find an element by class using startButton = driver.find_element(By.CLASS_NAME, "start is-armed") and I got a very weird error message. The end almost looks like it could be assembly language:
[23248:27252:0126/162232.236:ERROR:device_event_log_impl.cc(215)] [16:22:32.235] USB: usb_service_win.cc:415 Could not read device interface GUIDs: The system cannot find the file specified. (0x2)
[23248:27252:0126/162232.237:ERROR:device_event_log_impl.cc(215)] [16:22:32.238] USB: usb_device_handle_win.cc:1046 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
Traceback (most recent call last):
File "c:\Users\[myname]\OneDrive\Documents\Coding Projects\Python\learningSelenium.py", line 11, in <module>
startButton = driver.find_element(By.CLASS_NAME, "start is-armed")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\[myname]\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 830, in find_element
return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\[myname]\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 440, in execute
self.error_handler.check_response(response)
File "C:\Users\[myname]\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 245, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":".start is-armed"}
(Session info: chrome=109.0.5414.120)
Stacktrace:
Backtrace:
(No symbol) [0x00F96643]
(No symbol) [0x00F2BE21]
(No symbol) [0x00E2DA9D]
(No symbol) [0x00E61342]
(No symbol) [0x00E6147B]
(No symbol) [0x00E98DC2]
(No symbol) [0x00E7FDC4]
(No symbol) [0x00E96B09]
(No symbol) [0x00E7FB76]
(No symbol) [0x00E549C1]
(No symbol) [0x00E55E5D]
GetHandleVerifier [0x0120A142+2497106]
GetHandleVerifier [0x012385D3+2686691]
GetHandleVerifier [0x0123BB9C+2700460]
GetHandleVerifier [0x01043B10+635936]
(No symbol) [0x00F34A1F]
(No symbol) [0x00F3A418]
(No symbol) [0x00F3A505]
(No symbol) [0x00F4508B]
BaseThreadInitThunk [0x762E7D69+25]
RtlInitializeExceptionChain [0x77B0BB9B+107]
RtlClearBits [0x77B0BB1F+191]
Anyone know why this is happening?
By.CLASS_NAME always accept single class value NOT multiple class values.
Instead use css selector.
startButton = driver.find_element(By.CSS_SELECTOR, ".start.is-armed")
Related
I'm using the code below to try and open a specific chrome profile. Chrome starts and loads the profile but it doesn't do anything else.
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
#create chromeoptions instance
options = webdriver.ChromeOptions()
#provide location where chrome stores profiles
options.add_argument(r"--user-data-dir=C:\\Users\\{user name}\\AppData\\Local\\Google\\Chrome\\User Data")
options.add_argument(r"--profile-directory=Profile 2")
#specify where your chrome driver present in your pc
driver = webdriver.Chrome(options=options)
#provide website url here
driver.get("https://www.google.co.in")
It also gives me the below output in the terminal.
Opening in existing browser session.
Traceback (most recent call last):
File "C:\Users\path\bot2.py", line 11, in <module>
driver = webdriver.Chrome(options=options)
File "C:\Users\user\AppData\Roaming\Python\Python310\site-packages\selenium\webdriver\chrome\webdriver.py", line 81, in __init__
super().__init__(
File "C:\Users\user\AppData\Roaming\Python\Python310\site-packages\selenium\webdriver\chromium\webdriver.py", line 106, in __init__
super().__init__(
File "C:\Users\user\AppData\Roaming\Python\Python310\site-packages\selenium\webdriver\remote\webdriver.py", line 288, in __init__
self.start_session(capabilities, browser_profile)
File "C:\Users\user\AppData\Roaming\Python\Python310\site-packages\selenium\webdriver\remote\webdriver.py", line 381, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:\Users\user\AppData\Roaming\Python\Python310\site-packages\selenium\webdriver\remote\webdriver.py", line 444, in execute
self.error_handler.check_response(response)
File "C:\Users\user\AppData\Roaming\Python\Python310\site-packages\selenium\webdriver\remote\errorhandler.py", line 249, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited normally.
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location C:\Users\user\AppData\Local\Google\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Stacktrace:
Backtrace:
(No symbol) [0x00A86643]
(No symbol) [0x00A1BE21]
(No symbol) [0x0091DA9D]
(No symbol) [0x0093F2A7]
(No symbol) [0x0093A899]
(No symbol) [0x00976917]
(No symbol) [0x0097655C]
(No symbol) [0x0096FB76]
(No symbol) [0x009449C1]
(No symbol) [0x00945E5D]
GetHandleVerifier [0x00CFA142+2497106]
GetHandleVerifier [0x00D285D3+2686691]
GetHandleVerifier [0x00D2BB9C+2700460]
GetHandleVerifier [0x00B33B10+635936]
(No symbol) [0x00A24A1F]
(No symbol) [0x00A2A418]
(No symbol) [0x00A2A505]
(No symbol) [0x00A3508B]
BaseThreadInitThunk [0x753800F9+25]
RtlGetAppContainerNamedObjectPath [0x77507BBE+286]
RtlGetAppContainerNamedObjectPath [0x77507B8E+238]
I'm not sure what's wrong but it exits before opening the website.
It's launch chrome profile but not able to do any action after launch chrome profile and gives error bellow.
Note: i have successfully launched chrome browser...and i want to work on my profile not on every time create new instance.
My code is this---
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.keys import Keys
options=Options()
options.add_argument('--profile-directory=Default')
options.add_argument("user-data-dir=C:\\Users\\amit9\\AppData\\Local\\Google\\Chrome\\User Data\\")
driver = webdriver.Chrome(executable_path=(r"C:\Users\amit9\AppData\Local\Programs\Python\Python311\Scripts\chromedriver.exe"), options=options)
driver.get("https://www.google.co.in")
Error gives me after running code
PS C:\Users\amit9\OneDrive\Desktop\autogui> & C:/Users/amit9/AppData/Local/Programs/Python/Python311/python.exe c:/Users/amit9/OneDrive/Desktop/autogui/python/test.py
c:\Users\amit9\OneDrive\Desktop\autogui\python\test.py:10: DeprecationWarning: executable_path has been deprecated, please pass in a Service object
driver = webdriver.Chrome(executable_path=(r"C:\Users\amit9\AppData\Local\Programs\Python\Python311\Scripts\chromedriver.exe"), options=options)
Opening in existing browser session.
Traceback (most recent call last):
File "c:\Users\amit9\OneDrive\Desktop\autogui\python\test.py", line 10, in <module>
driver = webdriver.Chrome(executable_path=(r"C:\Users\amit9\AppData\Local\Programs\Python\Python311\Scripts\chromedriver.exe"), options=options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\amit9\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 81, in __init__
super().__init__(
File "C:\Users\amit9\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 106, in __init__
super().__init__(
File "C:\Users\amit9\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 288, in __init__
self.start_session(capabilities, browser_profile)
File "C:\Users\amit9\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 381, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\amit9\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 444, in execute
self.error_handler.check_response(response)
File "C:\Users\amit9\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 249, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited normally.
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location C:\Program Files\Google\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome
has crashed.)
Stacktrace:
Backtrace:
(No symbol) [0x006BF243]
(No symbol) [0x00647FD1]
(No symbol) [0x0053D04D]
(No symbol) [0x0055C24E]
(No symbol) [0x005582E9]
(No symbol) [0x0058F056]
(No symbol) [0x0058EB2A]
(No symbol) [0x00588386]
(No symbol) [0x0056163C]
(No symbol) [0x0056269D]
GetHandleVerifier [0x00959A22+2655074]
GetHandleVerifier [0x0094CA24+2601828]
GetHandleVerifier [0x00768C0A+619850]
GetHandleVerifier [0x00767830+614768]
(No symbol) [0x006505FC]
(No symbol) [0x00655968]
(No symbol) [0x00655A55]
(No symbol) [0x0066051B]
BaseThreadInitThunk [0x76B800F9+25]
RtlGetAppContainerNamedObjectPath [0x778A7BBE+286]
RtlGetAppContainerNamedObjectPath [0x778A7B8E+238]
I tried to launch custom profile in chrome using python selenium webdriver.
But I met error while running. I tried arguments --no-sandbox, --disable-dev-shm-usage, --remote-debugging-port=xxxx. But not working.
Here is code.
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
import time
options = webdriver.ChromeOptions()
options.add_argument("--profile-directory=Profile 6")
options.add_argument("--user-data-dir=C:/Users/SIM/AppData/Local/Google/Chrome/User Data")
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options)
time.sleep(3)
Here is output.
D:\me\web\fbot\src>python script_.py
Opening in existing browser session.
[7488:16428:1223/013230.522:ERROR:broker_win.cc(56)] Error reading broker pipe: The pipe has been ended. (0x6D)
Traceback (most recent call last):
File "D:\me\web\fbot\src\script_.py", line 10, in <module>
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options)
File "C:\Python310\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 81, in __init__
super().__init__(
File "C:\Python310\lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 106, in __init__
super().__init__(
File "C:\Python310\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 288, in __init__
self.start_session(capabilities, browser_profile)
File "C:\Python310\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 381, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:\Python310\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 444, in execute
self.error_handler.check_response(response)
File "C:\Python310\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 249, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited normally.
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location C:\Program Files\Google\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Stacktrace:
Backtrace:
(No symbol) [0x0103F243]
(No symbol) [0x00FC7FD1]
(No symbol) [0x00EBD04D]
(No symbol) [0x00EDC24E]
(No symbol) [0x00ED82E9]
(No symbol) [0x00F0F056]
(No symbol) [0x00F0EB2A]
(No symbol) [0x00F08386]
(No symbol) [0x00EE163C]
(No symbol) [0x00EE269D]
GetHandleVerifier [0x012D9A22+2655074]
GetHandleVerifier [0x012CCA24+2601828]
GetHandleVerifier [0x010E8C0A+619850]
GetHandleVerifier [0x010E7830+614768]
(No symbol) [0x00FD05FC]
(No symbol) [0x00FD5968]
(No symbol) [0x00FD5A55]
(No symbol) [0x00FE051B]
BaseThreadInitThunk [0x7762FA29+25]
RtlGetAppContainerNamedObjectPath [0x77CD7A7E+286]
RtlGetAppContainerNamedObjectPath [0x77CD7A4E+238]
Please help me to solve this error.
I assume your profile path is wrong,
try adding this command to your driver class:
options.add_argument("user-data-dir=/Users/alexiseggermont/Library/Application Support/Google/Chrome/Default/")
This path is usable for Mac or Linux OS. Also, rename "Default" to your profile id (for me, and in most cases, it was "Profile 1")
I am facing a issue while calling xpath, i got the current xpath element by using selectorshub to get the xpath, but seems that not correct.
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
driver_service = Service(executable_path="C:\Program Files (x86)\chromedriver.exe")
driver = webdriver.Chrome(service=driver_service)
PASSWORD = 'testtes'
login_page = 'http://192.168.2.1/login.html'
driver.get(login_page)
driver.find_element(By.XPATH,"//input[#placeholder='Password']").send_keys(PASSWORD)
Below is the error i'm getting
Traceback (most recent call last):
File "C:\Users\admin\Desktop\pyhton\index.py", line 13, in <module>
driver.find_element(By.XPATH, "//input[#placeholder='Password']").send_keys(PASSWORD)
File "C:\Python310\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 856, in find_element
return self.execute(Command.FIND_ELEMENT, {
File "C:\Python310\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 429, in execute
self.error_handler.check_response(response)
File "C:\Python310\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 243, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//input[#placeholder='Password']"}
(Session info: chrome=107.0.5304.88)
Stacktrace:
Backtrace:
There is the screenshot of the HTML code from where i am trying to get the xpath from screenshot
Attempting to run a code found from this github project
I keep running into the following errors:
DevTools listening on ws://127.0.0.1:12522/devtools/browser/17d610a1-0dc4-45da-8766-b1592dd689ab
Logging into Linkedin account ...
Traceback (most recent call last):
File ".\LinkedinEasyApply.py", line 244, in <module>
login(driver, username, password)
File ".\LinkedinEasyApply.py", line 49, in login
driver.get("https://www.linkedin.com/")
File "C:\Users\Seane\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 332, in get
self.execute(Command.GET, {'url': url})
File "C:\Users\Seane\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 320, in execute
self.error_handler.check_response(response)
File "C:\Users\Seane\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot determine loading status
from unknown error: missing or invalid 'entry.level'
(Session info: chrome=68.0.3440.106)
(Driver info: chromedriver=2.29.461591 (62ebf098771772160f391d75e589dc567915b233),platform=Windows NT 10.0.17134 x86_64)
I am using windows 64.. I'm not sure if Selenium can't find the path or what the issue is. Currently, the program opens Linkedin before the error occurs. I've tried numerous different solutions inlcuding different versions of chrome, and different paths to Selenium and Chrome.
If I use Chrome version 2.41 (the latest) I get this message...
Traceback (most recent call last):
File ".\LinkedinEasyApply.py", line 246, in <module>
searchJobs(driver)
File ".\LinkedinEasyApply.py", line 92, in searchJobs
search_button.click()
File "C:\Users\Seane\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\webelement.py", line 80, in click
self._execute(Command.CLICK_ELEMENT)
File "C:\Users\Seane\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\webelement.py", line 628, in _execute
return self._parent.execute(command, params)
File "C:\Users\Seane\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 320, in execute
self.error_handler.check_response(response)
File "C:\Users\Seane\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Element <button class="jobs-search-box__submit-button button-secondary-large-inverse" data-ember-action="" data-ember-action-1764="1764">...</button> is not clickable at point (971, 20). Other element would receive the click: <a id="ember1706" data-control-name="premium_nav_upsell_text_click" title="Free Upgrade to Premium" href="/premium/products/?destRedirectURL=https%3A%2F%2Fwww.linkedin.com%2Fjobs%2F%3FshowPremiumWelcomeBanner%3Dtrue&upsellOrderOrigin=premium_nav_upsell_text" class="link-without-visited-state nav-item__spotlight-upsell premium-upsell-link--long ember-view">...</a>
(Session info: chrome=68.0.3440.106)
(Driver info: chromedriver=2.41.578737 (49da6702b16031c40d63e5618de03a32ff6c197e),platform=Windows NT 10.0.17134 x86_64)
Thanks! & Let me know if I can be of any help.
Update
- You are trying to click an element that is not visible or clicking on another span because of an overlay over the button, given the error here -
Other element would receive the click: <a id="ember1706" data-control-name="premium_nav_upsell_text_click" title="Free Upgrade to Premium" href="/premium/products/?destRedirectURL=https%3A%2F%2Fwww.linkedin.com%2Fjobs%2F%3FshowPremiumWelcomeBanner%3Dtrue&upsellOrderOrigin=premium_nav_upsell_text" class="link-without-visited-state nav-item__spotlight-upsell premium-upsell-link--long ember-view">...</a>
Original Answer
Update your chrome driver (currently 2.29) from here to latest version 2.41 -
https://sites.google.com/a/chromium.org/chromedriver/downloads
Your current driver doesn't supports the Chrome version i.e. ver 68