C#硒:点击下面按钮的iframe [英] C# Selenium: Click button under iframe
问题描述
我在我的网站的iframe模式。我想点击按钮
,但我不能这样做。下面是我的code。请告诉我
我失去了什么。
I have a iframe modal under my site. I am trying to click button in it but I am unable to do so. Below is my code. Please let me know what am i missing
driver.SwitchTo().Frame(driver.FindElement(By.Id("iframeid='frame_name'")));
driver.FindElement(By.Id("sendReuqest")).Click();
预期结果:按钮ID:sendRequest将要获得点击这是在IFRAME
Expected Result: Button id: sendRequest should get clicked which is on iframe
实际结果:元素是找不到的。
请让我知道如果你有任何问题。
Please let me know if you have any questions.
推荐答案
试着做这种方式。让我们FRAME_NAME id作为iframe_1。不管你帧ID是可以添加的,而不是iframe_1。还你一个拼写错误(错误)它可能被sendRequest将让我加入作为你的按钮标识。
Try to do it this way. Let's take frame_name id as iframe_1. Whatever you frame id is you can add instead of iframe_1. Also you have a spelling mistake (typo) it might be sendRequest so I am adding as id of your button.
driver.SwitchTo().Frame(driver.FindElement("iframe_1")));
driver.FindElement(By.Id("sendRequest")).Click();
希望工程。请不要评论,让我们知道。
Hope it works. Please do comment and let us know.
好运。
这篇关于C#硒:点击下面按钮的iframe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!