I need to grab the link from certain link to perform crawling however I can't extract the link from the html no matter how many time I rewrite the xpath. Hence, I'm not able to find a way to extract the link from it. Please give some suggestion to me to solve the problem.
This is the html code for the link that I'm gonna to extract the link from:
<div class="" id="subject1" datacallname="主题_同类主题" params="{'catid':'12','sid':'336'}" isload="1" style="">
<ul class="rail-list">
<li>
<cite class="start0" style="height:16px;">
</cite>
<a href="http://www.gorate.com.my/item-386.html">the Library # Leisure Ma
</a>
</li>
how I can extract the link "//*[#id="subject1"]/ul/li[1]/a/#href" and the website
I gonna to scrape the link form : http://www.gorate.com.my/item-336.html#.Vhx55BOqqkr
Related
<nav class="Navbar">
<ul>
<li>
<a href=“index.html”>Home</a></li>
<li>
<a href=“contact.html”>About</a></li>
<li>
<a href=“Services.html”>Services</a></li>
<li>
<a href=“Contact.html”>Contact</a></li>
This is the error i get
Cannot GET /%E2%80%9CContact.html%E2%80%9D
The contact form you saved as "contact.html", check that the page can load independently and please check if it is saved in same folder as your document. You might want to get its src/ folder.
close your </ul> and </nav>
check your link and learn about relative and absolute links. a url will solve that problem if it is remote. if its local, make sure its not in a different directory.
check this page out
https://www.coffeecup.com/help/articles/absolute-vs-relative-pathslinks/
i bet one of those 2 things helps. keep us posted
Is there a way to link to a form using only HTML/CSS? I am still a beginner in web dev and have not yet started on JavaScript or JQuery.
So what I want to do is,
<div>
<ul>
<a href="??" target="_parent">
<li class="toggle1">Guest</li>
</a>
<a href="??">
<li class="toggle2">Owner</li>
</a>
</ul>
</div>
...in the tags in the I want to link to a form which has elements like First name, Last name etc, such that when I click on "Guest" the form for the guest should appear and likewise for "Owner"
There is! Make the href tags to #guestform and #ownerform. Then, make each form's id attribute those values (guestform and ownerform). This looks like so:
<div>
<ul>
<a href="#guestform">
<li class="toggle1">Guest</li>
</a>
<a href="#ownerform">
<li class="toggle2">Owner</li>
</a>
</ul>
</div>
<form id="guestform">...</form>
<form id="ownerform">...</form>
Then, in the css, do the following:
form {
display:none;
}
form:target {
display:block;
}
Hope this helped you!
EDIT: As sdcr said, the a tag should be inside the li, and not the other way around for it to be semantically correct. It should be like this instead
<div>
<ul>
<li class="toggle1">
Guest
</li>
<li class="toggle2">
Owner
</li>
</ul>
</div>
I may have misinterpreted your answer based on the lack of information given.
If you don't care who the end user is, and make both forums accessable to them no matter if they're a guest or owner, you'd simply create another HTML document and link to that document (provided that your web server can serves "static" content).
For instance, say you created another file called owner_form.html and somewhere within the body, you had:
<form>
...
</form>
From your index.html you could link to owner_form.html via a <a> tag like this:
... Contents that will redirect you
(old answer)
No, this is not possible in only HTML and CSS. Not even (securely & validly) with JavaScript.
HTML and CSS don't have the ability to differentiate the client using the page on their own. And JavaScript can't securely do this either.
You should look into server-side programming. This is where the magic would happen for you. You can try many different frameworks / scripting languages that have web-server functionality to them, for instance, some of the popular ones are:
Ruby on Rails
PHP
NodeJS
Django
I'm doing a little project and here's what I'm trying to do :
I use the Qt ui with a webView widget and I would like to extract a specific information from the source code of a web page. It's the Order Code of a component.
The part I would like to extract is 1758990 in this example:
<div id="productDescription">
<div class="brandLogo">
<a href="http://uk.farnell.com/multicomp">
<img id="supplier_logo" src="http://uk.farnell.com/productimages/promo/en_GB/2217096.jpg" alt="MULTICOMP"/>
</a>
</div>
<ul>
<li>
<strong>Manufacturer:</strong>
<a href="http://uk.farnell.com/multicomp">
MULTICOMP
</a>
</li>
<li>
<strong>Order Code:</strong>
1758990
</li>
<li>
<strong>Manufacturer Part No</strong>
MC0402B821K500CT
</li>
</ul>
<ul id="technicalData">
<li>
</span>Technical Data Sheet (877.82KB) EN
</li>
</ul>
</div>
I would like to use this order code and put it in a variable. The rest I would manage but I can't find the correct tools to find the code (which is never the same). I managed to extract the entire source code from the page with a toHtml() function and tried to export it to a textEdit but I don't really know what use it could have.
What should I use ?
Thank you in advance.
(also I'm sorry, I'm quite new at asking questions so forgive me if I f.. up the writing conventions)
EDIT:
I'm trying to use the findFirstElement() function but I can't find the correct query to extract only 1758990.
I can extract "Order Code: 1758990" with findFirstElement("#productDescription li:nth-child(2)") but I only want the order Code :.(
Okay I found a way (surely not the cleanest one but well...)
I have a button to retrieve the code :
void browser::on_Addtodbbtn_clicked()
{
QWebElement code = ui->webView->page()->mainFrame()->findFirstElement("#productDescription li:nth-child(2)");
QString OrderCode = code.toPlainText(); // at this point, OrderCode = "Order Code: 1758990"
OrderCode.remove("Order Code: "); // I remove the part I don't want
qDebug() << "OrderCode:" << OrderCode; // Here you go
}
this page helped me a lot: http://www.w3schools.com/cssref/css_selectors.asp
I coded some basic share buttons in HTML and CSS. I want to place these buttons on 300 different pages on a simple HTML website.
Is there a easy way to ask for the current link of the website instead of typing in the website URL manually?
Example:
Page 1 www.site.com/home.html
<a class='share-facebook' href="http://www.facebook.com/sharer.php?u= www.site.com/home.html" target="_blank">
This will now share the home page through Facebook:
Page 2 www.site.com/info.html
<a class='share-facebook' href="http://www.facebook.com/sharer.php?u=[current website url-tag or code?]" target="_blank">
What do I type in at "current website URL tag or code" to get the desired outcome? (share www.info.html without actually manually typing in the URL)
Is it even possible with only HTML? If not, how should the JS look like?
No, this isn't possible with pure HTML. In fact, this is often done server-side using languages such as PHP:
<a class='share-facebook' href="http://www.facebook.com/sharer.php?u=<?="http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"?>" target="_blank">
In JavaScript, you'll probably have to assign an id to your link first.
HTML:
<a class='share-facebook' href="http://www.facebook.com/sharer.php?u=[current website url-tag or code?]" target="_blank" id="facebook-button">
JavaScript:
document.getElementById("facebook-button").href="document.URL";
I am trying to set a link in the body copy of html mailto and i cant seem to get the link to work... here is my code [1]: http://jsfiddle.net/jsavage/5pZr7/
for some reason the link doesnt show up and not sure what I am doing wrong. Any help would be greatly appreciated! Thanks!
<li id="grey-contactus-icon"><a href= "mailto:info#3cheers.com?subject=info&body=The application beta launch will occur the week of May 28, 2013. You will be able to sign up then. If you would like us to contact you when the site is live, please click "href='http://experience.maritzmotivation.com/MoreInfo3Cheers'>here</a></li>
Refer this: MailTo with HTML body
It is not possible to have html in the body of the email if you to generate it using mailto
Well, you can just write the url as the part of the email. Most of the modern mail-clients will automatically recognise it.
<li id="grey-contactus-icon">Click to send email</li>
You have another href starting within the href text.
remove the following:
href='http://experience.maritzmotivation.com/MoreInfo3Cheers'
Here it is fixed:
<li id="grey-contactus-icon">here</li>
jsFiddle Fixed:
http://jsfiddle.net/5pZr7/1/
EDIT - FIXED --- TWO OPTIONS, LOOK AT CODE BELLOW
Two options:
1) with an email and an html link inside it:
<li id="grey-contactus-icon"><a href= "mailto:info#3cheers.com?subject=info&body=The 3Cheers application beta launch will occur the week of May 28, 2013. You will be able to sign up then. If you would like us to contact you when the site is live, please click <a href="http://experience.maritzmotivation.com/MoreInfo3Cheers">this link</a>">
Html Link</a></li>
2) with an email with no html link inside it (should work in most email clients this way!)
<li id="grey-contactus-icon"><a href= "mailto:info#3cheers.com?subject=info&body=The 3Cheers application beta launch will occur the week of May 28, 2013. You will be able to sign up then. If you would like us to contact you when the site is live, please click <a href="http://experience.maritzmotivation.com/MoreInfo3Cheers">this link</a>">
Pure Link</a></li>
updated fiddler:
http://jsfiddle.net/5pZr7/8/
EDIT 2 - mailto url encoded link
<li id="grey-contactus-icon">try this </li>