1

I want to get the source code of a website, but the html file get by using driver.get() is not showing all te information. So I plan to use these codes I found

import PyChromeDevTools
chrome = PyChromeDevTools.ChromeInterface()
chrome.Network.enable()
chrome.Page.enable()
chrome.Page.navigate(url="https://stackoverflow.com")
html_code=chrome.DOM.getOuterHTML()

Yet When I run the first 2 lines:

import PyChromeDevTools
chrome = PyChromeDevTools.ChromeInterface()

I immediatly get an error saying

ConnectionRefusedError                    Traceback (most recent call last)
File ~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\urllib3\connection.py:174, in HTTPConnection._new_conn(self)
    173 try:
--> 174     conn = connection.create_connection(
    175         (self._dns_host, self.port), self.timeout, **extra_kw
    176     )
    178 except SocketTimeout:

File ~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\urllib3\util\connection.py:95, in create_connection(address, timeout, source_address, socket_options)
     94 if err is not None:
---> 95     raise err
     97 raise socket.error("getaddrinfo returns an empty list")

File ~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\urllib3\util\connection.py:85, in create_connection(address, timeout, source_address, socket_options)
     84     sock.bind(source_address)
---> 85 sock.connect(sa)
     86 return sock

ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it

The existing infromation on this matter does not quite match with the case with the PyChromeDevTools module I was using. Any idea of what might go wrong?

Thanks in advance.

snoobiedoo
  • 15
  • 5

0 Answers0