JMeter - WebDriver Sampler - Autofill name by Google Map - groovy

I have a text field for filling the address. When entered few letters and the full wordings of location will be displayed. Normally it allow users to click on the full wordings for autofill the location. And this function is from Google Map. I am not sure how to get the autofill name from default Google Map in JMETER.
When I send keys ("57 Java") to text box, it will display "57 Java Road North Point" under the text box.
WDS.browser.findElement(org.openqa.selenium.By.xpath("//input[#value='']")).sendKeys("57 java");

These "suggestions" are loaded by AJAX technology and being added to the DOM as you're typing.
Not sure about your application, for "normal" Google Maps it can be located like:
//div[#class='suggest']
So these "suggestions" are normal HTML elements which can be "found" using any suitable locator strategy

Related

Can not drag file from local pc and drop on web page using python and selenium

I need drag file from my local pc and drop it on area on the web page
.send.keys('file_path') does not work.
drag_drop_area = driver.find_element_by_xpath("//*[#id='root']/main/div[3]/section[2]/div[2]/div[2]/div/div/div")
file = '/home/new/Desktop/CT_filters/Braid-s.png'
drag_drop_area.send_keys(file)
what is interesting place where I want to drag and drop file looks
and after run code looks like
Looks like some action was perform because field is highlighted
To upload a file from your PC with Selenium the best approach is to send the file path + name as a string to the appropriate element on the web page. This will not be an element you graphically clicking as a user with mouse rather some other element, normally located by this XPath:
//input[#type='file']
To give you more precise answer we need to see the actual web page HTML.

Kentico custom page url with URL "Path or Pattern" feature

Updated: As I put in the comment under Brenden's response. I think the issue is not related to multilingual site, but it's with using Properties/ URLs / Path or Pattern feature. After adding value to the field Path of Pattern, the whole navigation stops working properly.
I have a multilingual site (English, French). Currently the URLs are like below:
English: www.domain.com/en-us/contact-us
French: www.domain.com/fr-fr/contact-us
What I want for French is a custom (translated) url www.domain.com/fr-fr/contactez-nous
I followed this Kentico instruction - the bottom part of the page with using Path or Pattern by adding /contactez-nous in the box. Things seem ok, but upon clicking on the page with the new URL on the French site, the whole main navigation (done with Hierarchical Viewer) seems to stuck with that URL; clicking anywhere on the nav doesn't do anything.
Links outside the nav works fine. How to make the nav work again. Thanks for your help!
I think I got it. The GetDocumentURL() is using NodeAliasPath to determine the URL. However, if you have not specified the NodeAliasPath column in the Columns property of the hierarchical viewer, then the current page's NodeAliasPath is used - and thus all items have the same URL. Adding the NodeAliasPath to the Columns property should fix the issue, so the hierarchical viewer has access to the data of each individual item.
EDIT: it looks like that in some cases the DocumentURLPath column must be specified too.
Make sure you're testing this in another browser or even another browser in a private window. If you are testing in a new tab in the same window, the CMS caches the selected language in the Kentico UI and shows that in the browser window.
For instance, if you have selected "French" on the pages app in the bottom left under the content tree, then navigate to your site in a new tab, it will display French no matter how many times you change the language selector on your public site to a new language.
Secondly, check the URL aliases for the given pages in each language. Make sure you don't have an alias that is the same in each language. For instance /contact-us with French and /contact-us in English.

Google Translate Drop Down

i have purchased a website template and i need help concerning the website translator using google translate.
The translate works well but after selecting a language, a google drop down appears and when i scroll down, it still appears and hides my main header titles.
Can something be done like removing this drop down when i translate a language or can someone suggest me another method.
Thanks a lot.
The problem is the the contents in this bar are inside of an iframe, So you cant use javascript to trigger the close button.
Solution
Once the user chooses a language the an iframe with a class named 'goog-te-banner-frame'
is added.
You can use javascript to detect if it present and hide it
$(document).ready(function(){
if($('.goog-te-banner-frame').length > 0){//check if the iframe exsits
$('.goog-te-banner-frame').css('display','none');
$('body').css('top',0);//google adds top to the body so the bar wont cover website content
}
});
because this code uses jquery. make you sure you load it like this:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>

Is it possible to print ID properly straight from the browser?

I wanted to design a simple ID printing software for my company, where I would load a database of entries and generate HTML/php output using a Background image as template, and css/html positioned text for the details and image.
I plan to use it on my own browser, therefore i have full control over the browser print settings..
I actually tried to do a basic HTML page emulating the output and i just can't get it to print right on our Datacard ID Printer (prints directly to PVC ID cards) ..
though i've set the browser (firefox) margins to zero and the print settings to scale , it's either i get a small margin left and top side of the card, or the printer prints out 2 cards (the id spans through 2 or more pages)
Is there ever a way, perhaps the proper browser setting , or registry hack or something that can get my html page to print right on a standard ID size output?
Regards

Browser plugin/extension/addon to see id of all elements at once

Despite extensive Google search I haven't been able to find what I was looking for, so I'm hoping experienced SO users will have an answer.
I am looking for a Firefox or Chrome plugin that can automatically display elements' id attribute value inside an overlay on top of the actual elements. For instance:
The idea is to be able to have a quick snapshot of what id attributes are used within a page and where, instead of having to go through the entire page manually with tools such as Firebug or Firefox/Chrome's DOM inspectors (which only allow you to see elements one by one, not have a full picture).
Does anybody know a Firefox / Chrome plugin that can do that?
The "Web Developer" extension for Firefox / Chrome includes this feature. The option can be toggled by clicking on "Information -> Display Anchors".
https://addons.mozilla.org/en-US/firefox/addon/web-developer/
https://chrome.google.com/webstore/detail/web-developer/bfbameneiokkgbdmiekhjnmfkcnldhhm
In Firefox
In Chrome
Result
Instead of installing an extra extension, you could also enter $$('[id]') in the console, which results in a list of all elements with an "id" attribute.

Resources