Hello Stackoverflow community,
I am working with selenium IDE and I have the following problem:
I have to move a web content within a web content Management System from one folder to another. Therefore I have to click on a "Select" button to specify a target folder, then an iframe opens up where I can navigate through the "tree structure" of the folders.
The original page looks like this:
original page with "Select"-button
The structure of the web content management system is as follows: Home
# <<< existing line >>>
DocumentRoot "C:/xampp/htdocs"
# <<< existing line >>>
# <<< solution >>>
RewriteEngine on
RewriteRule /articles/(\w*)$ /articles/index.php?author=$1 [B]
# <<< solution >>>
Because the folder that I want to adress(UniqueTitle2) lies one hierarchy below my current folder(I am in UniqueTitle), I have to click on the parent Folder "TEST" to go one hierarchy back. This is a link to the "TEST"-folder.
iframe where you can select the target folder
The problem is that on the original page below the iframe, the same Link to the "TEST"-folder exists as a breadcrumb. So if selenium clicks on the href link, it actually clicks the link on the original page, and not the one in the iframe.
I tried the following: to select the iframe:
-Test(=Parent Folder):
-UniqueTitle
-UniqueTitle2
to click on the link:
storeAttribute|css=iframe.dialog-iframe-node@id|iframeIDE
selectFrame|id=${iframeID}
Here is a HTML Snippet of the iframe:
clickAndWait|link=TEST
clickAndWait|//a[contains(@href,'https://www.companyname.com/language/projectname/manage/maintenance/web-content-management[...]folderid=465576')]
How can I differentiate between these two, so my script will click within the iframe?
Thank you in advance and let me know if you need more information.
答案 0 :(得分:0)
you have two options:
using this approach, you have to move the code for file selection to the main page. use AJAX to populate the file list to the div. this approach is often called single page application, though you don't need to move everything to a single page, just the file selection codes.
you should read about how to set this HTTP header. here are some refs
答案 1 :(得分:0)
可能是How to switch between frames in Selenium WebDriver using Java
的副本当你想在iframe中做某事时,首先要切换到它。
WebDriver.SwitchTo().Frame(WebDriver.FindElement(By.Id("iframe")));
之后你可以点击元素。 当你想要回来时,你可以使用:
WebDriver.SwitchTo().DefaultContent();
答案 2 :(得分:0)
我正在使用selenium IDE ...
这可能是一个IDE错误。最初的selenium ide有时会出现iframe问题。
建议:从Kantu或Sideex尝试新的适用于Chrome的Selenium IDE - 两者都支持良好的frame / iframe(但它们不支持original Selenium IDE的所有命令,因此请测试如果其中一个为你工作)。