oren ben yamin oren ben yamin - 1 year ago 136
HTML Question

C# selenium cant find input in form

I am trying to locate a button in a form... but it doesnt find it...
I have tryed using threading.sleep(5000); but it dont help.
I have tryed so many ways but nothing helped me it always says that it cant locate the button...
here is my code:

IWebElement startb2 = driver.FindElement(By.XPath("//form/*[@name='start']"));

here is the html code of the form:

<form method="post" action="php/PickFruits.php">
<input type="submit" name="start" value="התחל לקטוף" class="button_submit" style="margin-right:-97px;">

I don't want to use the value because it is in Hebrew... and I cant use it in the c# console... please help me guys.


Now its find the location of the input but it doesnt click on it... code:

IWebElement startb = driver.FindElement(By.XPath("//*[@type='submit']"));

Answer Source

To switch to an iframe, use the below code.

//To find the iframe
IWebElement Object = driver.FindElement(By.XPath("//*[@class='active_iframe']");
//To switch to and set focus to the iframe

And then perform click operation.

IWebElement startb = driver.FindElement(By.XPath("//*[@type='submit']"));
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download