(Although is not supported by HTML 5)
Could someone provide an example HTML document wherein Magic Target Names :"_blank","_parent","_self". are used?
The Magic Target Names, as you call them, are basic HTML attributes, which exist for as long as I can think. What do they do:
A link to some content
The target attribute provides an option to specifiy, how the browser should handle your click on that link.
A link to some content
A link to some content
A link to some content
_self: opens the link in the same window instance
_parent: opens the link in a new window instance
_top: opens the link in the full body window
_blank: opens the link in a new tab
Related
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
-Test(=Parent Folder):
-UniqueTitle
-UniqueTitle2
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:
storeAttribute|css=iframe.dialog-iframe-node#id|iframeIDE
selectFrame|id=${iframeID}
to click on the link:
clickAndWait|link=TEST
clickAndWait|//a[contains(#href,'https://www.companyname.com/language/projectname/manage/maintenance/web-content-management[...]folderid=465576')]
Here is a HTML Snippet of the iframe:
TEST
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.
you have two options:
1. don't use iframe, use div or section instead
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.
2. set allow-origin header of your iframe to your domain name or *
you should read about how to set this HTTP header.
here are some refs
https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin
Probably duplicate of How to switch between frames in Selenium WebDriver using Java
First thing when you want to do something inside iframe is switch to it.
WebDriver.SwitchTo().Frame(WebDriver.FindElement(By.Id("iframe")));
After that you can click on element.
When you want to back you can use:
WebDriver.SwitchTo().DefaultContent();
So, I started learning HTML few days ago, it's really easy and I understand those basics, but I didn't found the thing I currently need... So, I made a Link on my website, and when I press that link it will go to my site for example if I click "Start" it will go to "_blank" where the new things comes. So when I press that link to go there, how do I make the code that will load in that new tab, I still don't understand it. Hope you understand what I want, thank you for your help.
target="_blank" Opens the linked document in a new window or tab
target="_self" Opens the linked document in the same frame as it was clicked (this is default)
target="_parent" Opens the linked document in the parent frame
target="_top" Opens the linked document in the full body of the window
Source: https://www.w3schools.com/tags/att_a_target.asp
The tag defines a hyperlink
Consider this example,
Visit W3Schools.com!
The "target" attribute specifies where to open the linked document, it can take any of the values in (_blank, _parent, _self, _top, framename) when it's value is '_blank' then the hyperlink will open in the new Tab.
Then "href" attribute will consist of the actual hyperlink, that is a URL that will open in the new page.
As you want a hyperlink for your own website, you need to give a link that works & would be served by your web server (Fro Ex., Apache). You need to put the web pages in the websever var/www/ folder if your server is linux with Apache webserver. Similarly. If you give any other website link as href, then that web page will be loaded.
Is it possible to click on a random <a> from a loaded HTML document in embedded webBrowser in my form? I'm using VB.net
I'm in a spot of bother. I've managed to get the Webbrowser to navigate to the page I want to be on, now i want it to invoke with page elements.
This is where it gets odd ok, sorry.
I have a rich text box of urls (these URLS are user inputted and match the links on the page I've already navigated to.)
I'd like to select a url at random from the richtextbox (up holds up to 10 lines) then find the href= on the page and invoke the <a>
Is this possible?
If I understand correctly, you have the webBrowser control with the current page loaded, and you want to select from the textbox a link to navigate to.
So you have the WebBrowser.Document.Body.InnerHtml property where you have the HTML of the loaded document, so i guess you can search that to match the input from your text box and with the url from the href call the Navigate method.
Hope that helps
WebBrowser.Document doesn't provide good Intellisense, but you have the full range of dom functions available to you at this point... (eg. getElementsByTag(string); )
Javascript run at page opening or later by user action like clicking a button with javascript attached, can alter the page contents and for instance change the layout in the browser.
Using right-click "View Source" shows the original content, not the changed one.
But how/from where can one retrieve the new, changed page contents?
You could use Firebug to see the live contents of the DOM, or you could use Web Developer's view generated source feature.
I have a home page on which, inside an IFrame a different HTML page is shown.
On that page there's a link, which on click, needs to open another page inside the same IFrame with specific tab shown. The new page has 3 tabs and the link need to open the second one.
There are other links too, which needs to open specific tabs. The problem is all this is for a demo purpose and no dynamic setting is there. No database or anything. All are static HTML pages.
Tab 2
assuming the page can parse the hash