diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-03-25 11:37:29 +0100 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-03-25 11:37:29 +0100 |
| commit | 855f1a93305d1eb95e91c29796b9112e199252f2 (patch) | |
| tree | 99c4381691ab5874cf8d1fa69fbe3c5675652644 /selenium_eduvpn.py | |
| parent | d033c8bb4103179b4971b5b067d9c440f254bdd7 (diff) | |
Login to oauth with selenium and test
Diffstat (limited to 'selenium_eduvpn.py')
| -rw-r--r-- | selenium_eduvpn.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/selenium_eduvpn.py b/selenium_eduvpn.py new file mode 100644 index 0000000..08b48ef --- /dev/null +++ b/selenium_eduvpn.py @@ -0,0 +1,30 @@ +import sys +from selenium import webdriver +from selenium.webdriver.common.keys import Keys +from pyvirtualdisplay import Display + +def login_oauth(driver, authURL): + driver.get(authURL) + assert "VPN Portal - Sign In" in driver.title + elem = driver.find_element_by_name("userName") + elem.clear() + elem.send_keys("docker") + + elem = driver.find_element_by_name("userPass") + elem.clear() + elem.send_keys("docker") + driver.find_element_by_css_selector('.frm > fieldset:nth-child(2) > button:nth-child(2)').click() + assert "VPN Portal - Approve Application" in driver.title + driver.find_element_by_css_selector('.frm > fieldset:nth-child(1) > button:nth-child(1)').click() + +if __name__ == "__main__": + if len(sys.argv) != 2: + print("Error: no auth url specified") + sys.exit(1) + disp = Display() + disp.start() + driver = webdriver.Firefox() + authURL = sys.argv[1] + login_oauth(driver, authURL) + driver.close() + disp.stop() |
