Skip to content

Commit

Permalink
updated popup interaction code with working code (mdn#30577)
Browse files Browse the repository at this point in the history
Previous version of code wouldn't produce desired results.

Co-authored-by: Hamish Willee <[email protected]>
  • Loading branch information
ShamarYarde and hamishwillee authored Dec 18, 2023
1 parent cbd8527 commit 4ac9cac
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -292,15 +292,17 @@ Try running your test again; the button will be clicked, and the `alert()` popup
You can interact with the popup too. Add the following to the bottom of the function, and try testing it again:

```js
await driver.wait(until.alertIsPresent());
(async function example() {
await driver.wait(until.alertIsPresent());

const alert = driver.switchTo().alert();
const alert = driver.switchTo().alert();

alert.getText().then((text) => {
console.log(`Alert text is '${text}'`);
});
alert.getText().then((text) => {
console.log(`Alert text is '${text}'`);
});

alert.accept();
alert.accept();
})();
```

Next, let's try entering some text into one of the form elements. Add the following code and try running your test again:
Expand Down

0 comments on commit 4ac9cac

Please sign in to comment.