簡體   English   中英

C#硒無法找到形式的輸入

[英]C# selenium cant find input in form

我試圖在表單中找到一個按鈕...但是找不到它...我嘗試使用threading.sleep(5000); 但它沒有幫助。 我嘗試了很多方法,但是沒有任何幫助,它總是說無法找到按鈕...這是我的代碼:

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

這是表單的html代碼:

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

我不想使用該值,因為它在希伯來語中……並且我不能在c#控制台中使用它……請幫助我。

編輯:

現在,它找到了輸入的位置,但沒有單擊它...代碼:

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

要切換到iframe,請使用以下代碼。

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

然后執行點擊操作。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM