I am trying to pass values like First name,Last Name etc in a window popup. I am attaching the screenshot of the page. The Html code behind the page:
<input type="text" name="lastname" value="" onblur="capAll(this);" class="critfont" size="22" maxlength="16">
I tried inspecting it and copy the Xpath, but it is unable to find the Element and is throwing exception.
My C# code is:
var wa = new WebDriverWait(Driver.Instance, TimeSpan.FromSeconds(10));
var LN = wa.Until(ExpectedConditions.ElementIsVisible(By.XPath("//*[@id='pageBodyNoHeader']/form/table[2]/tbody/tr[1]/td[2]/input")));
LN.Click();
LN.SendKeys("Aerere")
When I am running this code, it is throwing me an exception that it has timed out after 10 secs.
I have also tried this code:
Thread.Sleep(1000);
Driver.Instance.FindElement(By.XPath("//*[@id='pageBodyNoHeader']/form/table[2]/tbody/tr[1]/td[2]/input")).Click();
Driver.Instance.FindElement(By.XPath("//*[@id='pageBodyNoHeader']/form/table[2]/tbody/tr[1]/td[2]/input")).SendKeys("Whatever");
Over here the exception that it throws is "It is unable to find the field name".
Can someone please help? Thank you
In order to switch to the window popup, I have used the following code:
Driver.Instance.SwitchTo().Window(Driver.Instance.WindowHandles.Last());
Driver.Instance.Manage().Window.Maximize();