I wrote a python script to login to the wifi using selenium.
Until the I'm not logged in to wifi, there is no internet access. So, I can't directly run .install() which tries to access the internet and fails
Sample Code:
from selenium import webdriver
from selenium.webdriver.edge.options import Options
from selenium.webdriver.edge.service import Service
from webdriver_manager.microsoft import EdgeChromiumDriverManager as dr_mngr
from subprocess import CREATE_NO_WINDOW
import os
os.environ['WDM_SSL_VERIFY'] = '0'
service = Service(dr_mngr().install())
service.creationflags = CREATE_NO_WINDOW
options = Options()
options.add_argument("--headless")
options.add_argument("--ignore-certificate-errors")
driver = webdriver.Edge(options=options, service=service)
driver.get("http://www.google.com")
Output:
[WDM] - ====== WebDriver manager ======
[WDM] - Current edge version is 103.0.1264
[WDM] - Get LATEST edgedriver version for 103.0.1264 Edge
C:\Users\VirtualBox\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\urllib3\connectionpool.py:1043: InsecureRequestWarning: Unverified HTTPS request is being made to host 'msedgedriver.azureedge.net'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
warnings.warn(
C:\Users\VirtualBox\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\urllib3\connectionpool.py:1043: InsecureRequestWarning: Unverified HTTPS request is being made to host '172.25.0.1'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
warnings.warn(
[WDM] - There is no [win64] edgedriver for browser 103.0.1264 in cache
[WDM] - Trying to download new driver from https://msedgedriver.azureedge.net/<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>
Fortigate :: Login
</title>
<!-- HTML Source Code of Login Page here -->
</html>/edgedriver_win64.zip
C:\Users\VirtualBox\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\urllib3\connectionpool.py:1043: InsecureRequestWarning: Unverified HTTPS request is being made to host 'msedgedriver.azureedge.net'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
warnings.warn(
C:\Users\VirtualBox\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\urllib3\connectionpool.py:1043: InsecureRequestWarning: Unverified HTTPS request is being made to host '172.25.0.1'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
warnings.warn(
Traceback (most recent call last):
File "C:\Users\VirtualBox\LogiNetwork\test.py", line 10, in <module>
service = Service(dr_mngr().install())
File "C:\Users\VirtualBox\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\webdriver_manager\microsoft.py", line 61, in install
driver_path = self._get_driver_path(self.driver)
File "C:\Users\VirtualBox\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\webdriver_manager\manager.py", line 24, in _get_driver_path
binary_path = self.driver_cache.save_file_to_cache(driver, file)
File "C:\Users\VirtualBox\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\webdriver_manager\driver_cache.py", line 32, in save_file_to_cache
archive = save_file(file, path)
File "C:\Users\VirtualBox\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\webdriver_manager\utils.py", line 37, in save_file
os.makedirs(directory, exist_ok=True)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1264.0_x64__qbz5n2kfra8p0\lib\os.py", line 215, in makedirs
makedirs(head, exist_ok=exist_ok)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1264.0_x64__qbz5n2kfra8p0\lib\os.py", line 215, in makedirs
makedirs(head, exist_ok=exist_ok)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1264.0_x64__qbz5n2kfra8p0\lib\os.py", line 215, in makedirs
makedirs(head, exist_ok=exist_ok)
[Previous line repeated 76 more times]
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1264.0_x64__qbz5n2kfra8p0\lib\os.py", line 225, in makedirs
mkdir(name, mode)
OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: 'C:\\Users\\VirtualBox\\.wdm\\drivers\\edgedriver\\win64\\<!DOCTYPE html PUBLIC "-'
But when I run this after logging in to Wifi it takes the driver from cache and runs it.