Can someone help me to identify to how to correct the Xpath statement from the below code. At the moment when I run the code, its doing nothing i.e no error and no click action
DOM:
<li class="product-personal-login-new">
<a href="/safe-online-banking/safe-online-banking.page?" target="_self">
<span class="pl-login-ornage-box">
<img alt="" src="/assets/img/lock-icon.png">
LOGIN
</span>
</a>
Code snippet:
web.findElement(By.xpath("//img[contains(#src,'/assets/img/lock-icon.png')]")).click();
Related
I am new to ui-router.
I am trying to navigate to models state. When I take the first apporach with button it works fine but it fails when I do the same with img tag.
//it works:
<a ui-sref="models">
<button class="btn btn-primary">goto models state</button>
</a>
//below code does not work:
<a ui-serf="models">
<img src="/content/images/_genericDevice.png" />
</a>
Can anybody explain why is this so ?
Not sure if this is intentional, but you have a typo:
<a ui-serf="models">
ui-serf should be ui-sref
Semi-novice web developer getting increasingly frustrated with my Joomla editor changing my code. I've research online and found Q&As that hint at a similar problem but I can't seem to figure this out.
Essentially it's code to create a linked image with a text caption added on hover. Desired code shown below:
<ul class="photo-grid">
<li>
<figure><a href="index.php?option=com_hikashop&view=category&layout=listing&Itemid=179"><img src="images/purple-biothane-waterproof-dog-collars.jpg" alt="purple biothane waterproof dog collars" width="280" height="187" /><figcaption>
<p>Waterproof collars</p>
</figcaption></figure></a>
<p class="photocaption">FEATURED PRODUCT</p>
</li>
BUT each time I open the editor the </a> tag has been moved upwards, directly after the <img> tag. Can anyone offer a resolution, I'd really appreciate it. Thanks.
You are closing the <a> tag after </figure> but you have opened it within <figure> so therefore it needs closing inside <figure>. So use:
<ul class="photo-grid">
<li>
<figure>
<a href="index.php?option=com_hikashop&view=category&layout=listing&Itemid=179">
<img src="images/purple-biothane-waterproof-dog-collars.jpg" alt="purple biothane waterproof dog collars" width="280" height="187" />
<figcaption>
<p>Waterproof collars</p>
</figcaption>
</a>
</figure>
<p class="photocaption">FEATURED PRODUCT</p>
</li>
I am having some issues adding a hyperlink to a 'hcard' in ionic. I am using the following plugin (https://github.com/drewrygh/ionic-ion-horizontal-scroll-cards) and the codepen is here: http://codepen.io/drewrygh/pen/jEJGLx
When I try to add hyperlink to hcard nothing happens. What is the best way to do this, does anyone know?
<div ng-controller="barsCtrl">
<h4>Top Rated Bars</h4>
<hscroller>
<hcard ng-repeat="bar in bars" index="{{$index}}" desc="{{bar.name}}" image="{{bar.profile_pic}}">
</hcard>
</hscroller>
</div>
Do you mean you want the cards to link to something as an anchor tag? You can wrap the cards in an anchor tag: http://codepen.io/anon/pen/Nqvjpv
<a ng-repeat="item in items" href="http://www.google.com?q={{item.desc}}" target="_blank">
<hcard index="{{$index}}" desc="{{item.desc}}" image="{{item.image}}"></hcard>
</a>
How to click on one link among several to which all of them having same id.
And it has only one means through which we can get it,that is id.
And through xpath ,we can't do because every time I open the tab,location of that link changes,so xpath changes too.
There are lots of links having same id,it differs through text written above it.so to refer that link,I also mention it through that text,but still not able to do.
In other words,there are links(with images) placed one by one,on execution,I want 3 link to execute but it executes the first one due to having same id's.so what should I do to click the third link not the first one.
<span class="online-signal"></span>
<figure>
<img id="UserImagePreview" src='/Content/PatientPhotos/default.jpg' alt="" />
</figure>
<figcaption class="doc-des-cap" title="Y">Z </figcaption>
<figcaption>Rating: 4</figcaption>
<span class="select-btn">
<a id="linkAppointment" docid="727" docname="x" href="javascript:void(0)">Select</a>
</span>
<span class="offline-signal"></span>
<figure>
<img id="UserImagePreview" src='/Content/PatientPhotos/default.jpg' alt="" />
</figure>
<figcaption class="doc-des-cap" title="C">B</figcaption>
<figcaption>Rating: 0</figcaption>
<span class="select-btn">
<a id="linkAppointment" docid="49" docname="A" href="javascript:void(0)">Select</a>
</span>
Try using the below xpath
//figcaption[contains(#title, 'Y')]/preceding-sibling::figure/img[#id='UserImagePreview']
Replace the title with the <figcaption> title attribute of the respective img you want to locate
Hope this helps you...if it is still not working kindly get back
I am trying to put href link to slider images and text in ion-slide.
Here is the code of mine.
<ion-slide-box ng-show="!cloading">
<ion-slide ng-repeat="img in simgs">
<div class="box">
<a ng-href="#/menu/tab/featured-post/{{post.id}}" style="text-decoration:none;">
<img src="{{img.url}}" ></img>
<p class="prodblk2" ng-href="#/menu/tab/featured-post/{{post.id}}" >
{{img.title}}
</p>
</a>
</div>
</ion-slide>
</ion-slide-box>
The link is appearing, but its not working when I click on it. I guess, the ion-slider properties like sliding or dragging overriding the mouse actions.
I tried ng-href and even ng-click by adding some JS function.
I hope nothing wrong about the code. I think, I need to add some property to the ion-slide tag.
I searched for similar questions but I haven't found. If anybody knows it please help me.
Thanks in advance.
I end up with the same problem as you, my solution was to use ng-click on the ion-slide directive, because in there it will fire up.
So you can create a method, pass the id's you need as parameters and then handle the route in the controller. Here's my solution for your problem:
HTML:
<ion-slide-box ng-show="!cloading">
<ion-slide ng-repeat="img in simgs" ng-click="slideClick({{post.id}})">
<div class="box">
<a style="text-decoration:none;">enter code here
<img src="{{img.url}}" ></img>
<p class="prodblk2 >
{{img.title}}
</p>
</a>
</div>
Then create some method on your controller using $location to go to your URL.
JS:
$scope.slideClick = function(postId) {
$location.path("/menu/tab/featured-post/" + postId);
}