Tag Archives: Selenium error

[Solved] selenium Error: ERROR:ssl_client_socket_impl.cc(962)] handshake failed; returned -1, SSL

Solution:
This error occurs due to an unsafe address error, a loop error is reported, and the program is terminated. With a –ignore-certificate-errors parameter, those certificate errors are ignored, as follows:

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--ignore-certificate-errors')
driver = webdriver.Chrome(options=chrome_options)

 

[Solved] Selenium error: staleelementreferenceexception exception

StaleElementReferenceException

Problem reporting and solution

Problem reporting error

# clcik to the next page
web.find_element_by_xpath('//*[@id="nexthehe"]').click()

the element is no longer attached to the DOM : the element is no longer attached to the dom

Solution:

The element is no longer attached to the dom

Analyze the cause

It is possible that elements that are no longer attached to the DOM tree are guided (for example, document. Documentelement)

But the page content is not loaded and cannot be found

resolvent:

Still, looking for the element again

try:
    # clcik to the next page
    web.find_element_by_xpath('//*[@id="nexthehe"]').click()
    # time.sleep(1)
except Exception:
    print('failed to next page')
    web.find_element_by_xpath('//*[@id="nexthehe"]').click()