Expanding Brozzler's logging in capabilities

Some sites don't allow you to login without clicking on a button to open a retracted modal.

This update to the login code allows Brozzler to click on all elements that we think are related to opening a login modal.

Then, if there isn't a regular form, we will attempt to fill out abnormal form schemes.

The test_try_login test has been expanded for the new type of login form we are supporting.
This commit is contained in:
Jake L 2020-04-14 17:19:53 -04:00
parent 973af2c16e
commit 78365c9f35
No known key found for this signature in database
GPG key ID: 51A50F1A4138C8C7
3 changed files with 77 additions and 0 deletions

View file

@ -267,6 +267,7 @@ def test_try_login(httpd):
response_urls.append(msg['params']['response']['url'])
chrome_exe = brozzler.suggest_default_chrome_exe()
form_url = 'http://localhost:%s/site11/form1.html' % httpd.server_port
form_url_other = 'http://localhost:%s/site11/form2.html' % httpd.server_port
favicon_url = 'http://localhost:%s/favicon.ico' % httpd.server_port
login_url = 'http://localhost:%s/login-action' % httpd.server_port
# When username and password are defined and initial page has login form,
@ -282,6 +283,19 @@ def test_try_login(httpd):
assert response_urls[2] == login_url
assert response_urls[3] == form_url
# We are now supporting a different type of form, we'll test that here.
response_urls = []
username = 'user1'
password = 'pass1'
with brozzler.Browser(chrome_exe=chrome_exe) as browser:
browser.browse_page(form_url_other, username=username, password=password,
on_response=on_response)
assert len(response_urls) == 4
assert response_urls[0] == form_url_other
assert response_urls[1] == favicon_url
assert response_urls[2] == login_url
assert response_urls[3] == form_url_other
# When username and password are not defined, just load the initial page.
response_urls = []
with brozzler.Browser(chrome_exe=chrome_exe) as browser: