MCPcopy
hub / github.com/InstaPy/InstaPy / proxy_authentication

Function proxy_authentication

instapy/browser.py:160–182  ·  view source on GitHub ↗

Authenticate proxy using popup alert window

(browser, logger, proxy_username, proxy_password)

Source from the content-addressed store, hash-verified

158
159
160def proxy_authentication(browser, logger, proxy_username, proxy_password):
161 """Authenticate proxy using popup alert window"""
162
163 # FIXME: https://github.com/SeleniumHQ/selenium/issues/7239
164 # this feature is not working anymore due to the Selenium bug report above
165 logger.warning(
166 "Proxy Authentication is not working anymore due to the Selenium bug "
167 "report: https://github.com/SeleniumHQ/selenium/issues/7239"
168 )
169
170 try:
171 # sleep(1) is enough, sleep(2) is to make sure we
172 # give time to the popup windows
173 sleep(2)
174 alert_popup = browser.switch_to_alert()
175 alert_popup.send_keys(
176 "{username}{tab}{password}{tab}".format(
177 username=proxy_username, tab=Keys.TAB, password=proxy_password
178 )
179 )
180 alert_popup.accept()
181 except Exception:
182 logger.warning("Unable to proxy authenticate")
183
184
185def close_browser(browser, threaded_session, logger):

Callers 1

Calls 1

sleepFunction · 0.85

Tested by

no test coverage detected