Tag Archives: Chrome

[Solved] error“:“element click intercepted“,“message“:“element click intercepted“

Error reporting: Selenium project can run locally, and there is no graphical use case execution error on Jenkins deployed in CentOS virtual machine: element click intercepted

Troubleshooting ① first check whether the browser and driver versions match

Browser driver download address: http://chromedriver.storage.googleapis.com/index.html

Troubleshooting ② check whether there are chrome processes that have not been closed. If there are, you need to kill them in batches

 kill -9  $(pgrep chrome) 

Troubleshooting ③ if the driver version matches, report and correct the error. Add the following code, with the focus on adding window size

chrome_options = Options()
chrome_options.add_argument('--headless')     # To open the browser, comment out the line of code
chrome_options.add_argument('--disable-gpu')
chrome_options.add_argument("--window-size=1920,1080")  # Error reported when adapting jenkins build{"error":"element not interactable"}
chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument('--disable-dev-shm-usage')
driver = webdriver.Chrome(chrome_options=chrome_options)

Build successful

[Solved] USB: usb_device_handle_win.cc:1049 Failed to read descriptor from node connection…

USB: usb_device_handle_win.cc:1049 Failed to read descriptor from node connection: The devices connected to the system are not functioning.

When executing automated tests in python + selenium + pytest, I encountered the following error.

[25612:15512:0220/162104.300:ERROR:device_event_log_impl.cc(211)] [16:21:04.299] USB: usb_device_handle_win.cc:1049 Failed to read descriptor from node connection:
 The devices connected to the system are not functioning.(0x1F)

At present, the reason has not been found and can only be solved by violence:

Add the following options when starting chrome:

option = webdriver.chromeOptions()

# Prevent printing some useless logs
option.add_experimental_option("excludeSwitches", ['enable-automation', 'enable-logging'])
driver = webdriver.Chrome(chrome_options=option)

 

Supplement

For this statement

driver = webdriver.Chrome(chrome_options=option)

For chrome browsers, chrome_options=option, preferably written as options=option, that is:

driver = webdriver.Chrome(options=option)

Or you’ll see it in terminal

DeprecationWarning: use options instead of chrome_options
  driver = webdriver.Chrome(chrome_options=option)

[Solved] selenium.common.exceptions.WebDriverException: Message: unknown error: DevToolsActivePort file doesn

Error Messages: selenium.common.exceptions.WebDriverException: Message: unknown error: DevToolsActivePort file doesn’t exist

Traceback (most recent call last):
  File "/opt/Vcert/myVcert/vul.py", line 2, in <module>
    from selenium import webdriver
ImportError: No module named selenium
Traceback (most recent call last):
  File "/opt/Vcert/myVcert/vul.py", line 228, in <module>
    main()
  File "/opt/Vcert/myVcert/vul.py", line 44, in main
    browser = my_browser()
  File "/opt/Vcert/myVcert/vul.py", line 31, in my_browser
    browser = webdriver.Chrome(executable_path='/opt/bin/chromedriver', chrome_options=chrome_options)
  File "/opt/py3/lib64/python3.6/site-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__
    desired_capabilities=desired_capabilities)
  File "/opt/py3/lib64/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/opt/py3/lib64/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/opt/py3/lib64/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/opt/py3/lib64/python3.6/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: DevToolsActivePort file doesn't exist

 

Solution:
1. Kill chromedriver, kill webdriver, kill chrome.
2. Add browser.close() after each browser.

org/sqlite/native/Mac/aarch64 Error [How to Solve]

Problem Description:
When building a project with m1 chip, if you use room, you will get the following error because the sqlite jar package is not compatible with arm.

Caused by: java.lang.Exception: No native library is found for os.name=Mac and os.arch=aarch64. path=/org/sqlite/native/Mac/aarch64
    at org.sqlite.SQLiteJDBCLoader.loadSQLiteNativeLibrary(SQLiteJDBCLoader.java:333)
    at org.sqlite.SQLiteJDBCLoader.initialize(SQLiteJDBCLoader.java:64)
    at androidx.room.verifier.DatabaseVerifier.<clinit>(DatabaseVerifier.kt:68)
    ... 50 more

Solution:
To update the room version, you don’t need to add org.xerial:sqlite-jdbc:3.34.0 as the web says, just update the room directly as shown below.

    def room_version = "2.4.0-beta01"  
    implementation "androidx.room:room-runtime:$room_version"
    kapt "androidx.room:room-compiler:$room_version"
    implementation "androidx.room:room-rxjava2:$room_version"

jupyter notebook Sets Default Browser Error: SyntaxError: (unicode error) ‘utf-8‘ codec can‘t decode byte 0xd4

Jupiter notebook sets the default browser to open with an error
syntax error: (Unicode error) ‘UTF-8’ codec can’t decode byte 0xd4 in position 0: invalid continuation byte

The default code of the Notepad provided by the win system is ANSI. Just reopen the PY script in the notebook,
save it as a py script coded as UTF-8, and it’s OK to run the PY script.

Modify the name of the file: jupyter_notebook_config.py

Code reference

import webbrowser 
webbrowser.register( "Cent Browser", None, webbrowser.GenericBrowser(r"C:\Users\中文用户名\AppData\Local\CentBrowser\Application\chrome.exe"))
c.NotebookApp.browser = "Cent Browser"

Set default browser, CMD input

jupyter notebook --generate-config

Find the PY file of the default configuration file
open it with notepad and find this statement: # c.NotebookApp.browser =
at the bottom of this statement, enter the following statement: the following figure is the configuration of chrome, * * pay attention to double \\**

# c.NotebookApp.password = '' Here
import webbrowser
webbrowser.register('chrome', None, webbrowser.GenericBrowser(u'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe'))
c.NotebookApp.browser = 'chrome'

[Solved] deepin python Message: unknown error: cannot find Chrome binary

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
try:
   # browser = webdriver.Chrome('Here is the path to chrome')
    s = Service(r"/opt/apps/cn.google.chrome/files/chrome")
    driver = webdriver.Chrome(service=s)
    driver.get('https://www.baidu.com')
except Exception as e:
    print(e)

When running this code, an error is reported. You need to put the chrome file and chromedriver in the same directory

Just add the path

[Solved] Chrome Error: The request client is not a secure context

1. Background

When using Ajax to access across domains, an error is suddenly reported:

 Access to XMLHttpRequest at 'http://127.0.0.1:yyy/' from origin 'http://xxx:yyy' 
 has been blocked by CORS policy: 
 The request client is not a secure context 
 and the resource is in more-private address space `local`.

The general meaning is that the request is blocked by cross-domain policy, and the client is not secure.

2. Analysis

Baidu has found many times that it is caused by the upgrade of Chrome browser, and this problem also exists in edge browser.

3. Solution

Enter in the address field chrome://flags/#block -Secure private network requests , change the option to disable disable, and then restart the browser

[Solved] unknown error: DevToolsActivePort file doesn‘t exis

Scene

When using selenium, an error is reported one day, as shown in the title, and the code is as follows:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

option = Options()
option.add_argument('--headless')
option.add_argument('--no-sandbox')
option.add_argument('--disable-dev-shm-usage')

browser = webdriver.Chrome('./chromedriver',chrome_options=option)

browser.get('http://www.baidu.com/')
print(browser.title)
browser.quit()  

Solution:

First, ensure that the versions of Google Chrome and chrome River are consistent. If you are sure to be consistent, skip the following three steps.

    1. View Google Chrome version command:
google-chrome --version

I’m not sure about the command to view the chrome River version, but if you find the Google Chrome version, you can go to the following website to download the corresponding chrome river. If the versions are inconsistent, you need to download the consistent version from the download location

    1. google-chrome: http://dist.control.lth.se/public/CentOS-7/x86_64/google.x86_64/chromedriver: https://sites.google.com/a/chromium.org/chromedriver/downloads

Then the solution is to add an option

option.add_argument("--remote-debugging-port=9222")  # this

Running the test front-end project, Google browser accesses localhost with err_SSL_PROTOCOL_ERROR

Err appears in Google browser_SSL_PROTOCOL_ERROR

under test http://localhost:8080/ The following error occurred during

This web site cannot provide a secure connection. Localhost sent an invalid response err_SSL_PROTOCOL_ERROR

At this time, you need to open a blank page for input chrome://net-internals/#hsts
Find the delete domain policy
at the bottom of the left navigation bar. It has a delete domain security policies
example picture

then enter localhost in the domain input box and press Delete
and you’re done!

PS: this method is only for learning and use, and the user shall bear any legal disputes and consequences

Chrome browser settings cause err when accessing the website_ FAILED

When testing in the test environment, the Chrome browser in one environment cannot be accessed, and the following error is reported: failed to load resource: Net:: err_ FAILED 。 It’s OK to use other browsers, and it’s OK for other colleagues to use chrome browsers.

terms of settlement:

1. Open chrome://flags/#block -insecure-private-network-request

2. Disable block secure private network requests  

 

How to Solve Chrome Error: net::ERR_FAILED

I found that I couldn’t access the local project as soon as I started up after the holiday.

At first I thought it was a back-end problem, but the back-end checked for a while and found no problem. Then I used the Google browser of three colleagues to test that my IP access project can be successful. Testing with other browsers was also successful…
I reinstalled chrome, but I still couldn’t. finally, I analyzed the network and found that the request was blocked
the solution is as follows:

    1. browser address bar input: chrome://flags/ Search: Secure origins treated as secure change enabled to disabled

    1. or paste the project address into the following input box, you don’t need to change it to disabled
    OK, successfully solved