簡體   English   中英

無法在C#中使用selenium Web驅動程序單擊圖像按鈕

[英]Not able to click the image button using selenium web driver in C#

我正在使用硒自動化我的測試。 我目前無法點擊圖片按鈕。 請參閱下面的代碼

<input name="op-DPChoose-MAESTRO^SSL" type="image" src="/images/logos/MAESTRO.gif" alt="Maestro">

我使用下面的代碼來識別元素並單擊。

driver.FindElement(By.XPath("//img[@src ='/images/logos/MAESTRO.gif' and @alt='Maestro']")).Click();

不確定是什么問題。 有人可以幫忙嗎?

嘗試//input不是//img 除此之外,你的XPath應該沒問題

driver.FindElement(By.XPath("//input[@src ='/images/logos/MAESTRO.gif' and @alt='Maestro']")).Click();

暫無
暫無

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

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