How to select/click cursors/icon on a map. Selenium IDE - testing
I am facing a problem with selenium IDE
I want to select/click any 2 cursors on map page
I can't use the id's because every time you refresh the map you will get another different cursors with different id's, till now i was able to select/click only one cursor on map and I can't select another different one
I used
|clickAt | //map/area/ | |
&
|clickAt | //map/area/ | |
to click at one cursor
so please help me to be able to click another
All cursor details:
map id="gmimap208" name="gmimap208">
<area log="miw" coords="11,0,12,1,13,2,14,3,14,4,14,5,14,6,14,7,14,8,14,9,14,10,13,11,12,12,12,13,11,14,10,15,10,16,9,17,9,18,8,19,7,20,7,20,7,19,6,18,6,17,5,16,4,15,4,14,3,13,2,12,2,11,1,10,1,9,0,8,0,7,0,6,0,5,1,4,1,3,2,2,2,1,4,0,11,0" shape="poly" title="" style="cursor: pointer;">
</map>
<div class="gmnoprint" style="width: 15px; height: 21px; overflow: hidden; position: absolute; opacity: 0.01; left: 373px; top: 370px; z-index: 2000;">
<img style="position: absolute; left: 0px; top: 0px; width: 15px; height: 21px; -moz-user-select: none; border: 0px none; padding: 0px; margin: 0px;" src="/img/property_icons/free/normal.png" draggable="false" usemap="#gmimap226">
<map id="gmimap226" name="gmimap226">
a cursor XPath :
/html/body/div[5]/div[2]/table/tbody/tr/td[2]/div[3]/div[2]/div/div/div[3]/div[2]/div[50]/map/area
a cursor CSS :
html.win body.rtl div.content-for-layout div#page-container table tbody tr td div#Map div div div div div div.gmnoprint map#gmimap83 area
a cursor HTML :
<area log="miw" coords="11,0,12,1,13,2,14,3,14,4,14,5,14,6,14,7,14,8,14,9,14,10,13,11,12,12,12,13,11,14,10,15,10,16,9,17,9,18,8,19,7,20,7,20,7,19,6,18,6,17,5,16,4,15,4,14,3,13,2,12,2,11,1,10,1,9,0,8,0,7,0,6,0,5,1,4,1,3,2,2,2,1,4,0,11,0" shape="poly" title="" style="cursor: pointer;">
Thanks in Advance. :)
You are clicking at the first element twice.
You can specify which element to click on:
//map/area[1]
//map/area[2]
Should get you the first two.
Related
How do I follow a link through an image without having a link in the div?
The problem is that I can't figure out how to follow a link. The link goes to the page I want when I click on the image, and the desired page opens in a new tab. It's difficult to describe, it's easier to understand from the attached code <div class="css-1owz1l2"> <span class=" lazy-load-image-background blur lazy-load-image-loaded" style="position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; border-radius: 4px; cursor: pointer; object-fit: cover; display: flex;"> <img style="height: 100%; width: 100%; object-fit: cover; border-radius: 4px; background: rgba(0, 0, 0, 0) none repeat scroll 0% 0%;" src="https://public.nftstatic.com/static/nft/zipped/9082041d35194edd87f9078dc9440f7b_zipped.jpeg" sx="[object Object]"> </span> </div>
You can extract the link from src attribute of img element as following. In case "css-1owz1l2" class is unique you can do this: img = driver.find_element_by_xpath("//div[#class='css-1owz1l2']//img") link = img.get_attribute("src") Now you can use this link like this: driver.get(link) Or by any other way
You can trying catching the image element and clicking on it directly: # catching the image element image = driver.find_element_by_xpath("//div[#class='css-1owz1l2']//img") image.click()
How to locate this specific element?
So I was using selenium ide for some automation works and had real fun with it. But lately, when I'm in https://pay.google.com/gp/w/home/paymentmethods and try to click this button which says "Add payment method", selenium cant find it at all. things I tried: Css.finder: css=.b3id-payment-method-add-instrument-link span Xpath:idRelative xpath=//body[#id='iframeBody']/div[3]/div[2]/div/div[4]/a/div/div/span Xpath:position xpath=//div[4]/a/div/div/span xpath:innerText xpath=//span[contains(.,'Add payment method')] Even if I record clicks, selenium ide records things like select frame index=0 click css=.b3id-payment-method-add-instrument-link span which also doesn't work What should I do to locate this specific button?
<iframe frameborder="0" src="about:blank" id="mainWidget_:0Iframe" name="mainWidget_:0Iframe" style="border: 0px; vertical-align: initial; display: block; width: 100%; min-height: calc((100vh - 69px) - 113px); position: static; top: auto; visibility: visible; z-index: auto; background-color: inherit; height: 510px; left: auto; opacity: 1; transition: all 0s ease 0s;" title=""></iframe> Your element is in an iframe switch to it. <div class="b3id-info-message-html b3-info-message-html" data-was-visible="true"><span data-was-visible="true">Add payment method</span></div> a simple css selector would be .b3id-info-message-html.b3-info-message-html
how to handle span class drowpdown in selenium webdriver
I am not able to click and select the value from dropdown by using XPath driver.findElement(By.xpath(".//*[#id='ProcessTypeIGCombo']/span")).click(); MY HTML code is as below: <input class="ui-igcombo-field ui-corner-all" readonly="" style="float: left; display: block; position: absolute; height: 20px; width: 99.7921%;"> for more details please use the screenshots
Can I click on a div in VBA?
I have the following HTML code that I am trying to click: <div class="ListItems" style="top: 0px;"> <div class="sf-element-list-box-item sfpc-selected" style="top: 0px; height: 15px; line-height: 15px; width: 192px;" title="(All) 7 values"> (All) 7 values</div> <div class="sf-element-list-box-item" style="top: 15px; height: 15px; line-height: 15px; width: 192px;" title="A">A</div> <div class="sf-element-list-box-item" style="top: 30px; height: 15px; line-height: 15px; width: 192px;" title="C">C</div> <div class="sf-element-list-box-item" style="top: 45px; height: 15px; line-height: 15px; width: 192px;" title="D">D</div> I am now trying to click on the list item D. I have tried in several different ways, but I am not sure if I am actually able to click on a div. I tried this first: Set tags = IE.Document.getElementsByTagName("div") For Each tagx In tags If tagx.innerHTML = "D" Then tagx.Click End If Next Since that didn't work I tried this: For Each x In IE.Document.getElementsByTagName("div") If x.Title = "D" Then x.parentElement.Click Exit For End If Next I have found that I cannot use .title, .InnerText, or .innerHTML. Does anyone know of a way that I would be able to click or select the list item if it is a div? I don't believe that I am getting into the IF statement, meaning the .click never executes.
You can do this over the fireEvent in vba: tagx.FireEvent "onclick" this is the way to trigger an event in vba. EDIT: And sure you can use innerHTML and innerText. The returned elemnts implements the IHTMLElement interface. You can take a look at the documentation which properties are supported.
Div with Canvas in WebKit scrolls backwards
Maybe I'm missing something obvious here, but so far I've found nothing that makes any sense with this. I have a scrollable div with a canvas inside of it. In FF and IE all works as expected: Using drag scrolling with the mouse, the div scrolls normally. In WebKit, however, things are flipped. If I scroll up, the content moves down, if I scroll down, it moves up. If I scroll with my mousewheel, everything moves in the right direction. It's only using mousedown on the scroll bar that's screwed up. NOTE: I am using a 3rd party library to generate the contents of the canvas, which is where all the inline styles are coming from. My code is as follows: #Palette { height: 420px; overflow: auto; } <div id="Palette" style="position: relative; -webkit-tap-highlight-color: rgba(255, 255, 255, 0); cursor: move;"> <canvas width="268" height="420" tabindex="0" style="position: absolute; top: 0px; left: 0px; z-index: 2; -webkit-user-select: none; cursor: move;"> This text is displayed if your browser does not support the Canvas HTML element.</canvas> <div style="position: absolute; overflow: auto; width: 268px; height: 420px; z-index: 1;"> <div style="position: absolute; width: 1px; height: 1px;"></div> </div> <div style="position: absolute; overflow: auto; width: 268px; height: 420px; z-index: 1;"> <div style="position: absolute; width: 1px; height: 700px;"></div> </div> </div>
This is apparently an issue with WebKit 36. It is solved in 37.