Authenticate proxy using popup alert window
(browser, logger, proxy_username, proxy_password)
| 158 | |
| 159 | |
| 160 | def 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 | |
| 185 | def close_browser(browser, threaded_session, logger): |
no test coverage detected