I am using protractor with Jasmine framework for automating angular5 application. My developers have used API/created google maps dropdown as mentioned in the link
https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete
When user types on the address, google maps API is invoked and lists the places related to search, this will not populate/change any tags of developer tools HTML. So basically when user types address then it will populate the address dropdown and I want to select any address either through mouse/keyboard arrow key. When I am automating, I could reach till passing string to the address web element later it errors saying
No details available for input:'Mumbai'
with the popup displayed on the window. Any help is greatly appreciated.
I tried below code,
browser.actions().mouseMove(element(by.id('fromAddress-input')).sendKeys("Mumbai")).perform();
browser.actions().sendKeys(protractor.Key.ENTER).perform();
browser.actions().sendKeys(protractor.Key.ARROW_DOWN).perform();
browser.actions().sendKeys(protractor.Key.ENTER).perform();
First you need to switch to the Iframe that contains the elements you want, use this to change to the Iframe:
var driver = browser.driver;
var loc = by.tagName('iframe');
var el = driver.findElement(loc);
browser.switchTo().frame(el);
Create a function with this code and place after you load the page.
Then your code will work but remove the first enter, do this for example:
browser.actions().mouseMove(element(by.id('fromAddress-input')).sendKeys("Mumbai")).perform();
browser.actions().sendKeys(protractor.Key.ARROW_DOWN).perform();
browser.actions().sendKeys(protractor.Key.ENTER).perform();
change back to the main frame using this:
browser.switchTo().defaultContent();
Related
I want to be able to edit the Google Calendar UI to have custom fields show up when a user is creating an event. I know it is possible to patch events and add custom fields to it after, but I want these custom fields to be defaulted on the user's calendar so anytime they create an event, the options show up. The pop-up I'm talking about is below.
I know that you can use AppScripts to create an add-on on the side of the screen, but I would prefer to have the change made right in the user's main UI. It seems like this is possible, as there is a Zoom add-on that allows you to "Make it a Zoom Meeting" as seen in the screenshot above in the bottom right hand corner.
If anyone could point me towards an example/documentation on how to do this, that would be greatly appreciated. Thanks in advance!
There is a similar question asked here
Where a community member shared a few options such as:
Using a browser extension to inject your custom fields + the Google Calendar API + the OAuth required.
Create your own UI using Google Apps Script CardService and its HTML service.
I am using google map API to show our locations in a website
The problem:
I search something opening google.com and navigate to map, it is same as the locator on the website. It gives the same result.
When google is opened in local and navigate to map and do the same search, it will navigate to same place however the name is different. Please note it is not that name is in English and French that's the reason it is different. Basically this region on question is disputed over the countries.
Description:
When client opens google in his locale e.g. https://www.google.fr/ and navigates to google map he gets a different result, the name is different for the same place in google map as the place is in the border of 2 countries .
If you open by google.com it will show the widely accepted name whereas if you open google.xx and then open the same location the name will be different.
The locator by default is showing the global name in the website which the client does not want, he is asking for showing the name as displayed when opening from their region.
Is there a way I can set something like a data source or something to show google map based on some particular region.
Help will be appreciated.
Regards
Take a look here.
You can add an optional language parameter to the <script> tag when including the Maps API JavaScript code, specifying the language to use. For example, to display a Maps API application in Japanese, add &language=ja to the <script> tag.
I have been following this example here: https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete-addressform which shows how to have a field that implements the auto complete dropdown with Google maps, and then when the user selects an address to fill out the individual form elements (Like street name etc..).
The address field will already be filled out in my case though so I just need to fill out the form elements when the page loads using this address.
I have tried
$(document).ready(function(){
fillInAddress();
});
To force it on start but the form elements stay empty. Does any one have any ideas?
Thanks in advance!
I think doing only fillInAddress(); might not be enough, you have to do something with the autocomplete too. However, since it is not open source or mentioned anywhere in the docs, there seems to be no way to do that.
One work around would be to use the Places web service API to get the same info. For more information about that please refer to this.
I'm instantiating a google maps Autocomplete box, as such:
autocomplete = new google.maps.places.Autocomplete(input, options);
Now, when a user begins typing and the list of suggestions appears, if a user simply presses Enter I want the number one prediction to be used as the search term.
For example, when a user searches: London, I want to pull out and send London, United Kingdom - simply by the user pressing Enter.
I can pull out that prediction using (with the latest V3.11):
autocomplete.gm_accessors_.place.Gc.predictions[0].wg
However, this obviously relies on the "compiled" object names, such as Gc and wg which will change as Google updates their codebase.
What is the correct way of doing this? Is it supported by the Autocomplete API?
Notice
Please star this issue on Google to get a solution:
https://code.google.com/p/gmaps-api-issues/issues/detail?id=4945
there is no correct way when using places.Autocomplete, it's not implemented so far.
What you can do: the API creates the dropdown, a div with className "pac-container", and within that div for each prediction a div with the className "pac-item", you may use the text of the first .pac-item as value for the input.
A correct way would be to request the Places Autocomplete Service , but then you need to create the dropdown on your own.
I want to write an extension, which can allow users to use their mouses to select multiple tabs in Chrome (the select tabs will be highlighted), just like some multiple-tab handler extensions for Firefox, I have searched but didn't find any useful information, so I am wondering if there is a way to do it, or it's technically possible to build such an extension given Chrome's design?
Thanks!
Currently I'm using Google Chrome v20.0.1132.47 m
I can say this is already possible on that version.
All you need to do is to hold-down the CTRL key on the keyboard and then single-left click on each desired tab to multi-select them.
In addition, once they're selected, you can drag-drop them off the main window to create an independent session with those tabs on the new session. Really useful on dual monitors.
You can use the windows get function to get all of the tabs in a specified window or instead use getAll and iterate through each window then each tab within each of those windows. You must specify the option populate:true to get the tabs array to return populated. The property highlighted should tell you if that tab is highlighted.
chrome.windows.get(integer windowId, {populate:true}, function (window) {
var highlightedTabs = new Array();
for(var index in window.tabs)
if(window.tabs[index].highlighted)
highlightedTabs.push(windows.tabs[index]);
// your code here
});
For a full reference to the format of the tab object see below:
http://code.google.com/chrome/extensions/tabs.html#types