Skip to content

Commit 3436c31

Browse files
authored
Merge pull request #132 from mozilla/sl/private-browsing-password-doorhanger
Fix to the selectors (using xpath)
2 parents 1a1718e + c6986c1 commit 3436c31

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

modules/data/login_autofill.components.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,23 @@
2929
"groups": [
3030
"doNotCache"
3131
]
32+
},
33+
34+
"username-login-field": {
35+
"selectorData": "/html/body/div[1]/form[2]/input[1]",
36+
"strategy": "xpath",
37+
"groups": []
38+
},
39+
40+
"password-login-field": {
41+
"selectorData": "/html/body/div[1]/form[2]/input[2]",
42+
"strategy": "xpath",
43+
"groups": []
44+
},
45+
46+
"submit-button-login": {
47+
"selectorData": "/html/body/div[1]/form[2]/input[3]",
48+
"strategy": "xpath",
49+
"groups": []
3250
}
3351
}

modules/page_object_autofill_login.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,15 @@ def __init__(self, parent: "LoginAutofill") -> None:
2323

2424
def fill_username(self, username: str) -> None:
2525
if self.username_field is None:
26-
username_fields = self.parent.get_elements("username-field")
27-
self.username_field = username_fields[1]
26+
self.username_field = self.parent.get_element("username-login-field")
2827
self.username_field.send_keys(username)
2928

3029
def fill_password(self, password: str) -> None:
3130
if self.password_field is None:
32-
password_fields = self.parent.get_elements(
33-
"input-field", labels=["current-password"]
34-
)
35-
self.password_field = password_fields[0]
31+
self.password_field = self.parent.get_element("password-login-field")
3632
self.password_field.send_keys(password)
3733

3834
def submit(self) -> None:
3935
if self.submit_button is None:
40-
submit_buttons = self.parent.get_elements("submit-form")
41-
self.submit_button = submit_buttons[0]
36+
self.submit_button = self.parent.get_element("submit-button-login")
4237
self.submit_button.click()

0 commit comments

Comments
 (0)