So I have a website that we'll call www.main.com and inside of that I have an iframe with a table and in the cells of that table I want to have a link open in a new window, for example www.next.com.
The problem is that when I add the link to the table cell, it appends the parent to the link so instead of the href being just what I put there (href="www.next.com") the link ends up being "www.main.com/www.next.com" which of course is bogus.
How do I get it to not append the "www.main.com/" and only use what I pass into the href property?
It's not the fact that you're in an iframe, it's that if you want an absolute link you must include the http:// (i.e. href="http://www.next.com")
Related
Is it possible to link to an Element Id within a container that already has an element id?
My setup is that I have Tabs which have an element id, we use this to link our customers to open this tab. Within the tabs, we have accordions. Basically it is a FAQ section for different types, and each type has a huge list of FAQS which we categorise.
Currently, we are able to link customers to #type1 but cannot link #type1#faq1.
What we are trying to achieve is to give the customer a HTML URL link which opens up a tab, then opens up the FAQ accordion which has for this example an element id of #faq1.
I have some buttons (links) on my webpage which has a link with values in it so it filters the content on the page. The filter part is working fine but I can't get it to focus on the ID.
The current href value is:
website/?type=Appartment&submit2=#
What I want is that it goes directly to the div named houses so it does not keep going to the top.
I tried making the URL like this:
website/#houses?type=Appartment&submit2=#
But the above does not do anything at all.
Summary:
How do I target a div and have the form values in the URL at the same time?
Have you tried website/?type=Appartment&submit2=#houses?
I am attempting to use an xpath locator within a context for a Codeception test using the Selenium driver with Firefox. Specifically, I am trying to click the second link in the message body of an email, viewed with roundcube.
The body of the email is in the div with xpath //div[#class="rcmBody"]
I can get the link with this path: (//div[#class="rcmBody"]//a)[2]
But for some reason when I try //a[2] within the context of the body div, it returns all a elements within the iframe.
An example from codeception: (after selecting the correct iframe)
$I->click('//a[2]', '//div[#class="rcmBody"]')
This causes the web driver to click the second link in the iframe which comes before the body div begins.
I can also test this from directly in chrome:
$x('//a', $x('//div[#class="rcmBody"]')[0])
This returns a list of all a elements within the iframe, not within the context.
How can I get the context part to work?
Add a dot to the beginning of XPath to make it context-specific:
$I->click('(.//a)[2]', '//div[#class="rcmBody"]')
HERE^
Note that the parenthesis here are also important to get the desired a descendant of the parent.
Here's the case: I have a series of thumbnails in a page, and I would like to display several keywords over each image when the user hovers with the cursor. Each of those keywords are anchor tags that point to a search query. And each thumbnail (the image) should also be clickable (through the empty spaces that the keywords leave) and point to a specific page.
I have everything already coded, I'm just missing a way to display the keyword anchors over the image anchors. I already tried with an onclick="window.location.href=..." but when the user clicks the keyword, the onclick is also triggered (for instance: if I ctrl+click on a keyword, i get the keyword search on a different window, but the main window content changes as well).
Any help will be much appreciated. Thanks!
This is quite common and can definitely be done with plain HTML and CSS. You can also do it with JavaScript, but I prefer to avoid doing so if possible.
This example is perfectly valid HTML/CSS and should have no weird browser rendering issues (even as far back as IE 6).
http://jsfiddle.net/2JD76/1/
Basically you have a containing element, in this case a div, which has your linked thumbnail and linked keywords. They're hidden by default and only shown when the containing div is hovered.
The linked thumbnail is absolutely positioned so that it's taken out of the page flow which then allows the linked keywords to appear on top. I then use z-indexes to make sure that the keywords are always on a layer that is higher than that of the linked thumbnail.
You can not. It is illegal html.
Attach a click handler that changes the current location instead of the "greater ".
I was going to answer with a long reply but, well check out my Jsfiddle here. I was trying to solve something before and well...check it out.
http://jsfiddle.net/somdow/KSt6a/
If you look at the code, its doing exactly what you are describing.
On my Jsfiddle, theres a div box with space for an image(this is wher YOUR image would go), The image is on the code but not on the jsfiddle so youll see the alt tag....Anyways so, on mouse-over, it brings up another div with text dynamically created inside of it.
All you have to do is replace the image content with your own image, then Insert the links/keywords links you want into this line
.prepend('<div class="portSecRollOver"><div class="portSecInner"></div></div>');
and stick your words in between the <div class="portSecInner"> **YOUR WORDS HERE** </div> line
And change the CSS to fit your needs.
oh AND ps, DELETE this line (below) which is the one that dynamically appends text inside of "portSecInner", since your going to insert your own words, then you dont need this line.
$(this).find('.portSecInner').html("<h3 class='h34roll'>" + $(this).find('img').attr("alt") + "</h3>");
I have an html page with three divs containing text content. I want to scroll to a particular div depending upon the link that the user clicks on the home page.
There are three links on the home page; so what I want is if the user clicks on link 1 he is scrolled to div 1 on the resultant page, if he clicks on link 2 on the home page, then the page is scrolled to div 2 on resultant page and so on.
If you want to scroll the current document to a particular place, the
value of HREF should be the name of the anchor to which to scroll,
preceded by the # sign. If you want to open another document at an
anchor, give the URL for the document, followed by #, followed by the
name of the anchor.
Use a bookmark with the anchor tag:
First
Second
Third
You would just substitute the value after the '#' symbol to the appropriate element IDs.
Reference: http://devedge-temp.mozilla.org/library/manuals/1998/htmlguide/tags7.html
Most if not all new browsers also support the id as an anchor destination
<div id="div1">...</div>
Will respond to ...
as well as the name attribute does
Easiest method is using Fragment Identifier. Whenever you are creating links, attach the id of the element you want to scroll to, on the end of link. For example:
link.html#divToScrollTo
An example usage:
Scroll to div with divToScrollTo as id
After clicking on this link, the browser to first navigate to link.html and then scroll to an element with divToScrollTo Link.