Reputation: 918
I am trying to login to "https://www.quora.com/" , It has login screen where I put my username and password , It always throws Element not visible, I have gone through all other answers on SO , none of them working.
I tried to click the element via Javascript and ScrollintoView , but no avail.
IWebElement uname = driver.FindElement(By.Name("email"));
((IJavaScriptExecutor)driver).ExecuteScript("arguments[0].click();", uname);
js.ExecuteScript("arguments[0].scrollIntoView()", uname);
js.ExecuteScript("arguments[0].click()", uname);
uname.SendKeys("[email protected]");
None of them working.
Upvotes: 0
Views: 127
Reputation: 1
Find C# code for login as follows
[TestMethod]
public void QuoraLogin()
{
ChromeDriver webDriver = new ChromeDriver();
WebDriverWait wait = new WebDriverWait(webDriver, new TimeSpan(0, 0, 0, 30));
webDriver.Navigate().GoToUrl("https://www.quora.com/");
IWebElement email= wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath("//div[@class='login']//input[@name='email']")));
email.SendKeys("[email protected]");
IWebElement password = wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath("//div[@class='login']//input[@name='password']")));
password.SendKeys("123");
webDriver.FindElement(By.XPath("//div[@class='login']//input[@value='Login']")).Click();
}
Upvotes: 0
Reputation: 193058
To login to https://www.quora.com/
you need to send a character sequence to the Email and Password field and you can use the following solution:
Email field:
driver.FindElement(By.CssSelector("input.text.header_login_text_box.ignore_interaction[name='email']")).SendKeys("[email protected]");
Password field:
driver.FindElement(By.CssSelector("input.text.header_login_text_box.ignore_interaction[name='password']")).SendKeys("PankajKushwaha");
Upvotes: 0
Reputation: 52665
There is one more login form (hidden) on page with <input name="email">
element. You need to handle visible one. Try to use below code to locate required input field:
IWebElement uname = driver.FindElement(By.Xpath("//div[@class='login']//input[@name='email']"));
Upvotes: 1