I am using selenium webdriver for automation tool creation in C#. That automation working fine windows 7, but not working windows 10.
ex.
driver.FindElem
i got same error when FireFox updated to 47.0.1 version, because WebDriver was not compatible with that version without additional libraries or WebDriver update. Try to update Selenium, new 3.0.0 beta update came out 2016-08-04 at http://www.seleniumhq.org/download/
Try this:
Instead of .Click();*
use .SendKeys(Keys.Return);
driver.FindElement(By.XPath("//button[@type='submit']")).SendKeys(Keys.Return);
Update your browsers and drivers, make sure the browsers and driver version match - you can't use driver version 80 on browser version 70, that is why you get TimeoutException
That being said,
There are many reasons why click might not work, some of them:
First, try the obvious one (submit, not click)
driver.FindElement(By.XPath("//button[@type='submit']")).Submit();
If the above didn't work, continue here.
In order to bypass all the Click()
logic, use JavaScript to perform a raw click.
var element = driver.FindElement(By.XPath("//button[@type='submit']"));
((IJavaScriptExecutor)driver).ExecuteScript("arguments[0].click();", element);
As an extension method
public static void JavaScriptClick(this IWebElement element)
{
// get the driver
var driver = (IJavaScriptExecutor)((IWrapsDriver)element).WrappedDriver;
// execute the click
driver.ExecuteScript("arguments[0].click();", element);
}
// usage
driver.FindElement(By.XPath("//button[@type='submit']")).JavaScriptClick();
Resources
You can check Selenium Extensions (open source) for more samples
under folder: /src/csharp/Gravity.Core/Gravity.Core/Extensions
https://github.com/gravity-api/gravity-core
https://www.nuget.org/packages/Gravity.Core
If you use C# you can install the package and use it's extensions directly.
https://www.nuget.org/packages/Gravity.Core/
Install-Package Gravity.Core