'Selenium sendKeys(input) function executes before previous function has completed
Encountered an issue with a selenium automation script to login into a 'Trello' account. During execution of code pasted below, the password is entered before second login button is clicked.
My perception is that the occurrence of the id selector for the password input are same in both places.
- 1st place is the trello login page, after we pass the registered email, it will show another login button
- 2nd place is when we get redirected to the atlassian login page
Code execution steps:
- get to trello
- click login
- enter the login credentials
- wait and click another login button
- enter the password
- login into account and check for board name
In debug mode it does above, while in a regular execution run it passes the password before clicking the next login button.
I have added the following to the code:
IWebElement findGoogleLoginButton = wait.Until((d) => d.FindElement(
By.Id("google-auth-button")));
The intention of the above is to force the script to wait for right input window however I don't find this as a viable solution. Could you please help me understand why this occurs in normal execution mode and not in debug? What is best way to resolve this for normal execution?
public void loginToAccount() {
using (IWebDriver driver = new ChromeDriver()) {
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(15));
//go to main page
driver.Navigate().GoToUrl(trelloHomeUrl);
//find login button and click it
IWebElement loginButton = driver.FindElement(
By.CssSelector(".btn.btn-sm.btn-link.text-primary"));
loginButton.Click();
//find input field for login and pass data
IWebElement loginInput = driver.FindElement(
By.CssSelector("#user"));
loginInput.SendKeys(login);
//wait for another login button and click it after passing login
IWebElement logWithAtlas = driver.FindElement(
By.CssSelector("#login"));
logWithAtlas.Click();
//this was purly added because next step passwordInput pass password before button above is pressed
IWebElement findGoogleLoginButton = wait.Until((d) => d.FindElement(
By.Id("google-auth-button")));
//find input field for password and pass data
IWebElement paswordInput = wait.Until((d) => d.FindElement(
By.Id("password")));
paswordInput.SendKeys(password);
//find login button and click it
IWebElement loginIntoPage = wait.Until((d) => d.FindElement(
By.XPath("//*[@id='login-submit']")));
loginIntoPage.Click();
//get board name and compare to original
IWebElement webBoardName = wait.Until((d) => d.FindElement(
By.ClassName("boards-page-board-section-header-name")));
Assert.Equal(webBoardName.Text, boardName);
}
}
Solution 1:[1]
let joe = new people('Joe', 26, '#00ff00', (0, 1, 0), 2)
=> let joe = new people('Joe', 26, '#00ff00', new THREE.Vector3(0, 1, 0), 2)
and
this.person.position.set(this.position) => this.person.position.copy(this.position)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
