mirror of
https://github.com/standardebooks/web.git
synced 2025-07-12 09:32:24 -04:00
Update FA login flow to handle new login form
This commit is contained in:
parent
8641c57dbf
commit
f69be0ab1b
3 changed files with 35 additions and 23 deletions
|
@ -91,21 +91,25 @@ try{
|
|||
// Check if we need to log in to FA.
|
||||
// Wait until the `<body>` element is visible, then check the current URL.
|
||||
$driver->wait(20, 250)->until(WebDriverExpectedCondition::visibilityOfElementLocated(WebDriverBy::xpath('/html/body')));
|
||||
if(stripos($driver->getCurrentURL(), 'auth0.com')){
|
||||
if(stripos($driver->getCurrentURL(), 'auth.fracturedatlas.org')){
|
||||
$log->Write('Logging in to Fractured Atlas ...');
|
||||
|
||||
// We were redirected to the login page, so try to log in.
|
||||
/** @var WebDriverElement $emailField */
|
||||
$emailField = $driver->wait(20, 250)->until(WebDriverExpectedCondition::visibilityOfElementLocated(WebDriverBy::xpath('//input[@type="email"]')));
|
||||
$emailField = $driver->wait(20, 250)->until(WebDriverExpectedCondition::visibilityOfElementLocated(WebDriverBy::xpath('//input[@inputmode="email"]')));
|
||||
$emailField->sendKeys($faUsername);
|
||||
|
||||
/** @var WebDriverElement $passwordField */
|
||||
$passwordField = $driver->wait(20, 250)->until(WebDriverExpectedCondition::visibilityOfElementLocated(WebDriverBy::xpath('//input[@type="password"]')));
|
||||
/** @var WebDriverElement $submitButton */
|
||||
$submitButton = $driver->wait(20, 250)->until(WebDriverExpectedCondition::visibilityOfElementLocated(WebDriverBy::xpath('//button[@type="submit"]')));
|
||||
|
||||
// Fill out and submit the form.
|
||||
$emailField->sendKeys($faUsername);
|
||||
// FA requires an explicit click on the password field for some reason.
|
||||
$passwordField->click();
|
||||
$passwordField->clear();
|
||||
$passwordField->sendKeys($faPassword);
|
||||
$submitButton->click();
|
||||
|
||||
// Submit the form.
|
||||
/** @var WebDriverElement $form */
|
||||
$form = $driver->wait(20, 250)->until(WebDriverExpectedCondition::visibilityOfElementLocated(WebDriverBy::xpath('//form')));
|
||||
$form->submit();
|
||||
}
|
||||
|
||||
// Wait until the page finishes loading.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue