mirror of
https://github.com/internetarchive/brozzler.git
synced 2025-10-11 21:00:41 -04:00
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:
parent
973af2c16e
commit
78365c9f35
3 changed files with 77 additions and 0 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue