C#Selenium webelement.Click抛出异常不可交互

发布于 2025-02-14 00:14:18 字数 1012 浏览 1 评论 0原文

在这里输入映像

​href =“ https://i.sstatic.net/ij4sm.jpg” rel =“ nofollow noreferrer”>在这里输入映像

在此处输入图像描述

当我启动程序时,它启动并运行正常,直到它进行到我希望驱动程序单击按钮的地步,它给我抛出了Web元素的异常,这并不棘手。我尝试了很多方法,但它们都没有用。我认为的问题是,当此按钮单击时,HTML会更改。请帮助:D


这是使我驱动异常的代码行(C#):

driver.FindElement(By.XPath("//button[@id='exifInfoMobile']")).Click();

错误:OpenQA.Selenium.ElementNotInteractableException:'元素不可交互 (会话信息:Chrome = 103.0.5060.114)'


这是HTML:

<li class="photo-info">
       <button class="btn btn-photo-info" id="exifInfoMobile">
               <span class="text">info</span>
       </button>
</li>

我尝试使用WebDriverWait,按class Name和ID尝试,但它不起作用。我认为这与模型有关,因为当单击此按钮时,网站html通过在右侧添加信息面板来更改。再次对不起问题,但这是我第一次在这里问一个。

enter image description here

enter image description here

enter image description here

enter image description here

When I start the program, it starts and runs fine until it goes to the point where I want the driver to click the button and it throws me the exception the web element not intractable. I've tried a lot of methods but none of them worked. The problem I think is that when this button is clicked the HTMl changes. Please help :D


this is the line of code that trows me the exception (C#) :

driver.FindElement(By.XPath("//button[@id='exifInfoMobile']")).Click();

error : OpenQA.Selenium.ElementNotInteractableException: 'element not interactable
(Session info: chrome=103.0.5060.114)'


and this is the HTML :

<li class="photo-info">
       <button class="btn btn-photo-info" id="exifInfoMobile">
               <span class="text">info</span>
       </button>
</li>

I've tried with WebDriverWait , By class name and by id but it didn't work. I think it has something to do with a model because when this button is clicked, the sites html changes by adding an info panel on the right. Sorry again for the bad question but its my first time asking one here.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文