【发布时间】:2023-04-08 08:16:01
【问题描述】:
尝试使用 C# 查找并单击图像。出现如下错误。
new_eog.myclass.Logintest: OpenQA.Selenium.NoSuchElementException:无法定位元素: "method":"xpath","selector":"//img[contains(@src,'https://www.sandbox.paypal.com/en_US/i/b tn/btn_donate_LG.gif')]"}
下面是图片的html代码。
<input type="image" border="0" alt="Make payments with PayPal - it's fast, free and secure!" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_donate_LG.gif" name="submit">
下面是我用来定位和点击图片链接的代码。
IWebElement temp = wd.FindElement(By.XPath("//img[contains(@src,'https://www.sandbox.paypal.com/en_US/i/btn/btn_donate_LG.gif')]"));
temp.Click();
【问题讨论】:
标签: c# selenium-webdriver