RobotFrameWork: hit on a title of a link - robotframework

I made the tests so it hits on the ID of a link, however, the ID's are dynamic. So now i'd like to hit on the name of a link...
<a class="dxeHyperlink_Office2003O" id="ASPxMenu1" href="/Configuration/specimen.aspx">Omzetgroepen</a>
so how do I hit on the Omzetgroepen?

Xpath, based on the title:
//a[text()="Omzetgroepen"]
The target:
//a[#href="/Configuration/specimen.aspx"]

Related

I am not getting to click on href link

I am trying to click on Href link but with no success.
This is the HTML of the page I am trying to click:
And here is the code that I tryed to use.
Welcome Page Should Be Open
Location Should Be ${WELCOME URL}
Title Should Be OrangeHRM
Click Link id=welcome
Wait Until Element Is Visible id=welcome-menu 8
#Click Link href=https://opensource-demo.orangehrmlive.com/index.php/auth/logout
Click Link xpath://a{test()='logout'}
I tried with "href" and "xpath", but both give the error:
No keyword with name XXXXXX found.
Can you please tell me what I am doing wrong?
The error is because you only have a single space between Click Link and the xpath. You need two or more spaces to separate a keyword from its arguments.
Also, xpath://a{test()='logout'} is not a valid xpath expression. You need to change the curly braces to square brackets, and change test to text. You also need to change logout to Logout.
xpath://a[text()='Logout']
For Click Link, you can also just specify the link text or href, for example:
Click Link Logout

Track specific products purchase with Google Tag Manager

I'm having an issue with Google Tag Manager and Wordpress/WooCommerce
(I can't access to the backend).
I need to track when a specific type of product is purchased, the Sample of the main products (most of the products have their Sample).
The Sample can be purchased with other products or on its own.
I found a common element in the source code that is shown every time a Sample is purchased (see below). The element colour-card-a5 appears when the sample is bought on the checkout page in two different areas:
Area #1
dataLayer.push({
"pagePostType":"page",
"pagePostType2":"single-page",
"pagePostAuthor":"root",
"ecommerce":{
"currencyCode":"EUR",
"purchase":{
"actionField":{
"id":"22481",
"affiliation":"",
"revenue":"1.70",
"tax":"0",
"shipping":"0.00",
"coupon":""
},
"products": [
{
"id":13487,
"name":"Genert",
"sku":"AQA021",
"category":"Contemporary",
"price":1.7,
"currency":"EUR",
"stocklevel":null,
"quantity":1,
"variant":"colour-card-a5,interior-design"
}
]
}
},
"event":"gtm4wp.orderCompletedEEC"
});//]]>
Area #2
<td class="woocommerce-table__product-name product-name">
<a href="https://www.example.com/product/genert/?attribute_pa_size=colour-card-a5&attribute_pa_finish=interior-design">
Genert - Colour Card (A5), Interior Design
</a>
<strong class="product-quantity">× 1</strong>
</td>
As the checkout page is example.com/checkout/order-received, I implemented this a Trigger:
Trigger type: Element Visibility
Method: CSS Selector
Element Selector: colour-card-a5
When to fire this trigger: Once per page
Minimum Percent Visible: 1
This trigger fires on: Some Visibility Events
Fire this trigger when an Event occurs and all of these conditions are true:
Page URL | contains | order received
But once I buy the Sample, the tag it's not fired.
I'm sure I'm missing something but can't realise what.
Anyone can help?
Thanks in advance
Your CSS selector provided (colour-card-a5) does not match any elements in your provided HTML. You should use a[href*="colour-card-a5"], which will select any anchor, which has a href attribute, that contains colour-card-a5 string in it.
You should also check, if the element is present in the DOM during page load, or it is added later by a script. In this latter case, you should enable DOM inspection in the trigger setting, to allow triggering for any added elements.

Google tag manager Click tracking not working

I am trying to do a simple tag that measures the amount of times an element is clicked.
I got into difficulty so I looked to find a video to help because tag manager layout had changed.
I follow the following Free tutorial on Udemy
https://www.udemy.com/google-tag-manager-advanced/
Specifically chapter 8 Button Click - which is a free chapter. 

It tells me to setup the following options:
Tag Configuration:
Google Analytics

Tracking ID: {{Tracking ID}}
Track Type: Event
Category: Click
Action: Homepage CTA Button
Label: (blank)
Value: (value)
Then on the trigger:
Add a new one.
Name it - click on homepage button
Add “Just Links”
He ticked the wait for tags
The where it said “Enable this trigger when all of thee conditions are true” he selected
Page Path in the drop down menu.
Now here is where my issue is. When I do exactly the same thing, I only have the following options:
Google Analytics Settings
Page Hostname
Page Path
Page URL
Referrer
New Variable…
Now the new Variable send to to a new window which gives me the following options:
Navigation:
http referrer
URL
Page Variables:
1st-Party Cookie
Custom Javascript
Data Layer Variable
JavaScript Variable
Page Elements:
Auto-Event Variable
DOM Element
Utilities:
Constant
Custom Event
Environment Name
Google Analytics Settings
Lookup Table
Random Number
Container Data:
Container ID
Container Version Number
Debug Mode
So how do I setup the trigger to load on every page and track if someone clicks on the element with a CSS ID of menu-item-6825???
Totally lost on this one.
In your case you need:
1) Go to "Variables" menu in the sidebar.
2) Click "Configure"
3) Enable "Click Classes", "Click ID", "Click Element" variable
After this steps, you need to configure trigger and create condition: Click ID - equals - menu-item-6825. OR condition like that: Click Element - matches CSS selector - #menu-item-6825. Both conditions are doing the same thing.

how to make the link in drupal open in new window which is redirected for "Link this field to the original piece of content"?

I have created the view which is having the fetched contents of title body etc..,title is connected with "Link this field to the original piece of content",
and i want that link should be opened in the new window,please help me on this,is there any way to make this?
Thanks in Advance.
Probably the easiest way would be to do that with JavaScript. Something like explained here:
How do I add target="_blank" to a link within a specified div?
$(document).ready(function(){
$('#link_other a').attr('target', '_blank');
});
And instead of that "#link_other a" you should put something for detecting your link(s) that you want to open in different page/tab.
To Click title field choose Rewrite result option and put this html code and save the view.
<a href="node/[nid]" target="_blank">[title]<a/>

DalekJS Click without an ID

Which is the right way to instrument DalekJS to click a link without an ID but based on the href?
Example:
Submit a form and then click on a link without an ID.
.click('href[URL]')
Have a look at the tutorial video (http://vimeo.com/71466029), at 8:00 he shows exactly what you need to do ;-)
.click('a[href="/foo.html"]')

Resources