c# - Element obscured when Selenium testing Edge webdriver for Azure Active Directory login Sign in to your account page -
i'm using selenium make integration test. part of test logon process microsoft azure active directory uses
the test passes when using internetexplorerwebdriver, fails edgewebdriver error:
element obscured
the relevant part of code:
var wait = new webdriverwait(webdriver, timespan.fromseconds(10)); webdriver.url = settings.urlhome(); var signinelement = webdriver.findelement(by.id("signinlink")); signinelement.click(); wait.until(expectedconditions.elementtobeclickable(by.id("my_login_name"))); var loginlogomicrosoft = webdriver.findelement(by.id("my_login_name")); loginlogomicrosoft.click();
the error occurs when executing last click(). i've tried several other elements, none of them working. 'inspect element' determine elements receives click error when implementing in code.
how can make microsoft azure active directory logon process part of selenium test?
a same kind of issue found here.
i use following code filling out azure ad login form. caveat when fill username field "sign in" button disabled until ajax operation done in background. trick wait until there's sign in button on page without class.
private void submitloginform() { var useanotheraccount = driver.findelements(by.classname("use_another_account")).firstordefault(); if (useanotheraccount != null) { useanotheraccount.click(); } var logininput = driver.findelements(by.id(site.login.usernameinput)).firstordefault(); if (logininput != null) { logininput.sendkeys(testingdata.username); logininput.sendkeys(keys.tab); } var passwordinput = driver.findelements(by.id(site.login.passwordinput)).firstordefault(); if (passwordinput != null) { passwordinput.clear(); passwordinput.sendkeys(testingdata.password); passwordinput.sendkeys(keys.enter); } var wait = new webdriverwait(driver, timespan.fromseconds(5)); wait.until(f => f.findelement(by.cssselector("#cred_sign_in_button:not(.disabled_button"))); var loginbutton = driver.findelements(by.id(site.login.signinbutton)).firstordefault(); if (loginbutton != null) { loginbutton.click(); return; } throw new invalidoperationexception("could not click login button"); }
Comments
Post a Comment