User Tag List

Results 1 to 3 of 3
Like Tree1Likes
  • 1 Post By dlai

Thread: Does selenium web driver Automate Map functionality?

  1. #1
    Join Date
    Nov 2007
    Post Thanks / Like
    0 Post(s)
    0 Thread(s)

    Does selenium web driver Automate Map functionality?

    I am in the process is selecting a country called US from the Maps(it's not Google maps, its jvectormaps), but WebDriver actually selects a different State. This is not a timing issue, a state is selected it is just the incorrect state.
    I have tried using Xpath selector but it's clicking on different state rather than what i expected(US). I want to select the Marker by multiples clicks o the state.
    Order: US->California->Santaclara->Sanjose.

    Expected: There a marker on San jose which i need to select. but before selenium fails to clicking on all these different states before. I have hard coded this but it's not working.


    It's not a timings issue. And I have tried all the below alternatives to click on the Map/Area element,none of them worked for me.

    List<WebElement> map = mDriver.findElement(By.id("world-map")).findElements(By.tagName("path"));
    for (int i=0;i<map.size();i++){
    if (map.get(i).getAttribute("data-code").equalsIgnoreCase("IN--2")){
    Actions action = new Actions(mDriver);
    //WebElement we = mDriver.findElement(By.xpath("html/body/div[13]/ul/li[4]/a"));
    action.moveToElement(map.get(i)).build().perform() ;

    Please help me to give your valuable suggestion.

    ~ Raghavan
    Last edited by eyunni; 08-19-2013 at 03:35 AM.

  2. #2
    SQA Knight
    Join Date
    May 2006
    Playa Del Rey, California, United States
    Post Thanks / Like
    17 Post(s)
    1 Thread(s)
    See if you can reformulate the xpath expressions without the hard coded indexes. If the page is loading ajax or has JavaScript generating the elements, the index could be different each time since elements could be created a different order.

    If you can create or link to an online example demonstrating the problem, than I could take a further look.
    Last edited by dlai; 08-19-2013 at 06:12 AM.
    eyunni likes this.
    David Lai
    SDET / Consultant
    LinkedIn profile

  3. #3
    SQA Knight
    Join Date
    Jun 2008
    Post Thanks / Like
    3 Post(s)
    1 Thread(s)
    Looking at jvectormap.com. Since it's javascript based with an api, I would look into making calls to that directly or try to fire the appropriate javascript events. Rather than trying to map to xpath.

    Also looks like you could map it by class.
    i.e. looking in firebug for Greenland it has this with a nice unique "data code" that you should be able to work into a driver.findElement(By.className

    <path class="jvectormap-region jvectormap-element" d="M304.13,6.6l8.19,-3.63l8.72,0.28l0.19,-0.06l3.12,-2.28l8.75,-0.61l19.94,0.8l14.93,4.75l-3.92,2.01l-9.52,0.27l-13.48,0.6l-0.27,0.2l0.09,0.33l1.26,1.09l0.22,0.07l8.81,-0.67l7.49,2.07l0.19,-0.01l4.68,-1.78l1.76,1.84l-2.59,3.26l-0.01,0.36l0.34,0.11l6.35,-2.2l12.09,-2.32l7.31,1.14l1.17,2.13l-9.9,4.05l-1.43,1.32l-7.91,0.98l-0.26,0.31l0.29,0.29l5.25,0.25l-2.63,3.72l-2.02,3.61l-0.04,0.15l0.08,6.05l0.07,0.19l2.61,3.0l-3.4,0.2l-4.12,1.66l-0.04,0.54l4.5,2.67l0.53,3.9l-2.39,0.42l-0.19,0.48l2.91,3.83l-5.0,0.32l-0.27,0...l2.62,-4.1l-0.03,-0.36l-1.51,-1.75l-1.97,-3.3l-3.01,-5.21l-0.1,-0.11l-3.04,-1.85l0.03,-1.94l-0.18,-0.28l-6.82,-3.01l-5.35,-0.38l-6.69,0.21l-6.03,0.37l-2.81,-1.59l-3.84,-2.9l5.94,-1.5l5.01,-0.28l0.28,-0.29l-0.26,-0.31l-10.68,-1.38l-5.38,-2.1l0.27,-1.68l9.3,-2.6l9.18,-2.68l0.19,-0.16l0.97,-2.05l-0.18,-0.42l-6.29,-1.91l1.81,-1.9l8.58,-4.05l3.6,-0.63l0.23,-0.4l-0.92,-2.37l5.59,-1.5l7.66,-0.95l7.58,-0.05l2.65,1.84l0.31,0.02l6.52,-3.29l5.85,2.24l3.55,0.49l5.17,1.95l0.38,-0.16l-0.13,-0.39l-5.77,-3.16l0.29,-2.26Z" data-code="GL" fill="white" fill-opacity="1" stroke="none" stroke-width="0" stroke-opacity="1" fill-rule="evenodd">
    Last edited by NoUse4aName; 09-06-2013 at 06:48 AM.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 01:00 PM.

Copyright BetaSoft Inc.