Having some trouble handling a facebook auth dialog popup through webdriverio. Struggling to target the email and password fields for the facebook signup process.
Below is the code in question:
it('redirects after signup', () => {
browser.url('/');
const mainTab = browser.getCurrentTabId();
browser.waitForExist('[data-test="facebook-login-button"]');
browser.click('[data-test="facebook-login-button"]');
// fb login form
browser.waitForExist('#email');
browser.setValue('#email', this.fbAccount.email);
browser.setValue('#pass', this.fbAccount.password);
browser.click('input[type="submit"]');
// fb login authorization
browser.waitForExist('button[type="submit"]');
browser.click('button[type="submit"]');
browser.switchTab(mainTab);
browser.waitForExist('[data-test="intro-title"]');
});
Attempted to wait until the tab opens with the following code:
browser.waitUntil(() => browser.getUrl().indexOf('facebook.com') > -1);
Also attempted switching tabs more explicitly like so:
browser.switchTab(
browser.windowHandles().value[browser.windowHandles().value.length]
);
However, all of these variations lead to browser.waitForExist('#email');
timing out and not finding the email input after 30 seconds. The popup does open and is focused, but webdriver or selenium can't locate the required element even when I try manually clicking on it.
Any advice on how to handle this scenario correctly? Open to any recommendations on making this test successful.