I have a website with a jQuery slide down at the top with a list of all the languages I want to use: http://testing.bestshippers.com/net/index.aspx, the slider is "language selection" button at the top.
I can click it, but I get and error when trying to click on the elements inside of the slide down. I believe it is because I need to pause for a few seconds before I try to select them. Could be wrong? I'm relatively new, but I have read all kinds of things about the WebDriverWait and changing focus.
//check spanish
driver.FindElement(By.XPath("//*[@id='openCloseWrap']/img")).Click();
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(100));
driver.FindElement(By.Id("ButtonSPFlag")).Click();
String check = driver.FindElement(By.XPath("html/body/form/div[5]/div/div[1]/div/p")).Text;
Console.Out.WriteLine(check);
The above code clicks on the openCloseWrap (Language Selection Button) and then I am trying to pause for seconds (100) and then trying to click on the SP flag to change the language.
Anyone able to provide any assistance with why my wait will not pause?
You are initiating the Wait, but not waiting for anything. You probably want to do something similar to:
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(100));
// wait.Until(By.Id("ButtonSPFlag"));
IWebElement element = wait.Until(driver => driver.FindElement(By.Id("ButtonSPFlag")));
element.Click();
Alternatively you can set implicit wait, but I would go with the first one.
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10));