Tag Archives: Chrome

[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

The vscode installation plug-in liveserver specified browser reported an error and could not be found

Problem Description:

After installing vscode, you do not want to use the default IE browser. You want to specify chrome or Firefox, but install the plug-in lever server or other browser plug-ins. When specifying the default browser, windows reports an error and cannot find chrome or Firefox
after reading many posted on the Internet, they are configured in settings.json. After personal practice, they have no effect. Later, after their own exploration, they found that the plug-in can’t find your chrome or Firefox. It’s not that you haven’t installed it on your computer, let alone on disk C; But because when a plug-in such as lever server specifies a browser, the windows system will find the installation directory of the software according to the system variables.

terms of settlement:

1. Open the control panel of the computer – & gt; System and security —– & gt; System
2. Open advanced system settings, click environment variables, system variables, and add a new variable named path: D: \ Kiki \ Mozilla Firefox
this directory is the directory where your Google or Firefox exe files are located
3. After configuring environment variables and saving, restart vscode