Watir webdriver code for property inside a property - watir-webdriver

I have the following code, and I need to click on the contact us link and Browse the forum link. Also I need to grab the url associated with this links.
<ul class="default">
<li>
<a class="supportlink" href="http://customer.comcast.com/contact-us/?CMP=ILCCOMCOM165146" data-cim-behavior="external">
<b class="icon left contact"></b>
Contact Us
<b class="ichevron">»</b>
</a>
</li>
<li>
<a class="supportlink" href="http://forums.comcast.com/?CMP=ILCCOMCOM164894" data-cim-behavior="external">
<b class="icon left forum"></b>
Browse the Forums
<b class="ichevron">»</b>
</a>
</li>
</ul>

The most straight-forward thing to do would be to locate the links by their text. However, so that you do not have to deal with the chevron in the text, I would suggest using a regex for just the text portion.
The "Contact Us" link would be accessed by:
browser.link(:text => /Contact Us/)
To click it, you would use the click method:
browser.link(:text => /Contact Us/).click
To get the url, you would use the href method:
browser.link(:text => /Contact Us/).href
#=> http://customer.comcast.com/contact-us/?CMP=ILCCOMCOM165146"
The "Browse the Forum" link would be similar:
browser.link(:text => /Browse the Forums/).href
browser.link(:text => /Browse the Forums/).click

Related

Search result heading in Google Custom Search

I have the following HTML which is indexed by Google Custom Search. I am using Microdata with Schema.org.
<p>
<link itemprop="url" href="/static/Books/A_Good_Foundation.pdf">
<a href="/static/Books/A_Good_Foundation.pdf" onclick="trackOutboundLink(‘A Good Foundation’);">
<button type="button" class="btn btn-default btn-md">
<span class="glyphicon glyphicon-book"></span> Read
</button>
</a>
</p>
I want to be able to get itemprop on the URL not the HTML page which hosts the URL. I can't modify the PDF.
Any ideas?
You're already declaring the .pdf URL to be the URL of the book, although your code doesn't show the itemtype to which your itemprop belongs. The <link> isn't necessary unless it's required for other purposes: the url property can just as readily be attached to the URL.
<p itemscope itemtype="http://schema.org/Book">
<a itemprop="url" href="/static/Books/A_Good_Foundation.pdf" onclick="trackOutboundLink(‘A Good Foundation’);">
<button type="button" class="btn btn-default btn-md">
<span class="glyphicon glyphicon-book"></span> Read
</button>
</a>
</p>
sdsf

Add Microdata/Schema.org autocompletion suport to PHPStorm

Exist way add schema.org autocompletion to PHPStorm ?
For example I want autocompletion for
itemscope itemtype="http://schema.org/Article"
yes. For the code like
<div itemscope itemtype="http://data-vocabulary.org/Person">
My name is <span itemprop="name">Smith</span>
<span itemprop="<ctrl+space here>" itemscope itemtype="http://data-vocabulary.org/Address">
<span itemprop="locality">Albuquerque</span>
<span itemprop="region">NM</span>
</span>
</div>
completion suggests the corresponding properties. But you need to fetch the resource to make it work - hit Alt+Enter on the URL and choose 'Fetch external resource'

Creating a Facebook share button with customized url, title and image

Facebook used to allow custom parameters in the Facebook share button, but it is not working now. What I need is to create a Facebook share button which will have a custom title, url, image, description, etc. It cannot be done using meta tags because there are multiple share buttons on a single page. Each should have a different title, urls, images etc. I heard it can be done using the Facebook app - using app id or something.
I tried this but it's not working:
<a title="send to Facebook"
href="http://www.facebook.com/sharer.php?s=100&p[title]=YOUR_TITLE&p[summary]=YOUR_SUMMARY&p[url]=YOUR_URL&p[images][0]=YOUR_IMAGE_TO_SHARE_OBJECT"
target="_blank">
Unfortunately, it appears that we can't post shares for individual topics or articles within a page. It appears Facebook just wants us to share entire pages (based on url only).
There's also their new share dialog, but even though they claim it can do all of what the old sharer.php could do, that doesn't appear to be true.
And here's Facebooks 'best practices' for sharing.
This is the code as 2017:
<i class="fa fa-facebook-square"></i>
Share on Facebook
Facebook now takes all data from OG metatags.
NOTE: This code assumes you have OG metatags on in site's code.
Source
Use facebook feed dialog instead of share dialog.
Example:
https://www.facebook.com/dialog/feed?app_id=1389892087910588
&redirect_uri=https://scotch.io
&link=https://scotch.io
&picture=http://placekitten.com/500/500
&caption=This%20is%20the%20caption
&description=This%20is%20the%20description
Crude, but it works on our system:
<div class="block-share spread-share p-t-md">
<a href="http://www.facebook.com/share.php?u=http://www.voteleavetakecontrol.org/our_affiliates&title=Farmers+for+Britain+have+made+the+sensible+decision+to+Vote+Leave.+Be+part+of+a+better+future+for+us+all.+Please+share!"
target="_blank">
<button class="btn btn-social btn-facebook">
<span class="icon icon-facebook">
</span>
Share on Facebook
</button>
</a>
<a href="https://www.facebook.com/FarmersForBritain" target="_blank">
<button class="btn btn-social btn-facebook">
<span class="icon icon-facebook">
</span>
Like on Facebook
</button>
</a>
</div>

Google RDFa breadcrumbs

I am currently trying to implement RDFa breadcrumbs to my webpages. I think that I am following the example for multiple breadcrumbs on one page correctly, however in the testing tool and search results the breadcrumbs are not processed as expected (are extracted, but the breadcrumbs are not displayed).
Can you plese give me a hint what am I doing wrong.
Thanks.
Page with the breadcrumbs
<div class="breadCrumb">
<span typeof="v:Breadcrumb">
Algoritmy.net >
<span rel="v:child">
<span typeof="v:Breadcrumb">
<a ref="v:url" property="v:title" href="/category/39974/Mathematics">Mathematics</a> >
<span rel="v:child">
<span typeof="v:Breadcrumb">
<a ref="v:url" property="v:title" href="/category/48669/Primality">Primality</a> >
<span rel="v:child">
<span typeof="v:Breadcrumb">
Rabin-Miller test
</span>
</span>
</span>
</span>
</span>
</span>
</span>
</div>
"ref" isn't a valid RDFa or HTML attribute, make sure you spell it right: rel.
ref="v:url" should be rel="v:url"

urls getting confusing when display json result using jquery

HTML code:
<a id="" onmouseover="LinkshimAsyncLink.swap(this, "http:\/\/www.tbogard.com\/2008\/05\/31\/tutorial-how-to-jsonp-with-jquery-using-getjson-or-ajax\/");" rel="nofollow" style="" onclick="LinkshimAsyncLink.swap(this, "http:\/\/www.facebook.com\/l.php?u=http\u00253A\u00252F\u00252Fwww.tbogard.com\u00252F2008\u00252F05\u00252F31\u00252Ftutorial-how-to-jsonp-with-jquery-using-getjson-or-ajax\u00252F&h=CAQFB81hM&s=1");" target="" title="" href="http://www.facebook.com/l.php?u=http%3A%2F%2Fwww.tbogard.com%2F2008%2F05%2F31%2Ftutorial-how-to-jsonp-with-jquery-using-getjson-or-ajax%2F&h=CAQFB81hM&s=1">
<img class="img" alt="" src="https://fbexternal-a.akamaihd.net/safe_image.php?d=AQDDROkII35SUCO7&w=90&h=90&url=http%3A%2F%2Fi2.wp.com%2Fwww.tbogard.com%2Fwp-content%2Fuploads%2F2010%2F10%2Frjson.jpg%3Ffit%3D400%2C400">
</a>
<br>
<a id="" onmouseover="LinkshimAsyncLink.swap(this, "http:\/\/www.tbogard.com\/2008\/05\/31\/tutorial-how-to-jsonp-with-jquery-using-getjson-or-ajax\/");" rel="nofollow" style="" onclick="LinkshimAsyncLink.swap(this, "http:\/\/www.facebook.com\/l.php?u=http\u00253A\u00252F\u00252Fwww.tbogard.com\u00252F2008\u00252F05\u00252F31\u00252Ftutorial-how-to-jsonp-with-jquery-using-getjson-or-ajax\u00252F&h=wAQFEyL2-&s=1");" target="_blank" href="http://www.facebook.com/l.php?u=http%3A%2F%2Fwww.tbogard.com%2F2008%2F05%2F31%2Ftutorial-how-to-jsonp-with-jquery-using-getjson-or-ajax%2F&h=wAQFEyL2-&s=1">Tutorial : How to JSONP with jQuery using $.getJSON or $.ajax</a>
<br>
www.tbogard.com
<br>
Remote Services is a now-a-day need, and sadly few documented in detail. Here you can learn how to use Remote JSON (JSONP) In your web-applications with jQuery, PHP and
i got above source codes using firebug. here is my page, when i click some URL in the site it says bellow error message in the facebook.
I get the facebook page feeds via json with yql api support. But what i want is when i click some urls in my site like this
www.tbogard.com
it will link to the given url without accessing facebook. Is there any way to do this?