Can sameone help me to click on a toogle button using VBA/Selenium:
HTML:
<img name="toggleFiltro" src="https://curyempreendimentos.sienge.com.br/sienge/imagens/base/toggleDown.png" onmouseover="IH_toggleOver(this)" onmouseout="IH_toggleOut(this)" style="cursor: pointer;">
Here is what I tried so far, but it's not displaying the information:
ChromoLink.FindElementByXPath("//img[#src='https://curyempreendimentos.sienge.com.br/sienge/imagens/base/toggleDown.png']").Click
and this one:
ChromoLink.FindElementByXPath("//*[#name=""divFiltro""]").Click
I got it:
ChromoLink.FindElementByXPath("//*#id=""holderConteudo2""]/form/div[9]/span/img").Click
Related
I am trying to login on a company website to upload a file. I am successful on login process but I failed on selecting the "Text button" that expands the other selection.
[enter image description here][1]
Below is the HTML elements.
<div class="tree_margin" id="tree_root/14+" style="text-decoration: none; display: block;">
<a class="tree_hover" href="JavaScript:tree_switch_folder('tree_root/14+');">
<img src="skin/blue/sidemenu_minus.jpg" border="0" alt="資材システム" align="absmiddle"> 資材システム</a><br></div>
資材システム
I tried the code below but it gives me "error:438".
Set objIE = New InternetExplorerMedium
objIE.Document.getElementByClassId("tree_root/14+").Click
Thank you in advance for your help.
Assuming you have left a sufficient page load wait, and that you have shown the correct html, I believe you want to click the anchor tag. You can target its class via css class selector and the querySelector() method:
objIE.Document.querySelector(".tree_hover").click
I've been trying to navigate through a webpage and testing the different links using Robot and Selenium.
I need to click several Dropdown menus. In Google chrome it works fine, but when I use Firefox there will always be one dropdown menu (not always the same one) that will appear selected (Like when a mouse passes over a button), but it will not get clicked.
The code I've been using:
Wait Until Element Is Visible //*[#id="Modules"]/a timeout=20s
Click Element //*[#id="Modules"]/a
Wait Until Element Is Visible xpath: //*[contains(text(), "Tasklist")] timeout=20s
Click Element xpath: //*[contains(text(), "Tasklist")]
This is the element HTML code:
<li id="Modules" class="nav-item nav-item-levels mega-menu-full show">
<a href="#" class="navbar-nav-link dropdown-toggle" data- toggle="dropdown" aria-expanded="true">
<i class="fa fa-lg fa-modx"></i>
<span class="menu-item-name" style="color: inherit; display: none;">Modules</span></a>
And this is the screen I'm trying to click on (In my test case, the "modules" dropdown menu appears selected, but the menu doesn't drop down)
Screenshot
So far I've tried increasing selenium_speed and adding a sleep command before clicking, but nothing seems to work.
Anyone knows what the problem with Firefox could be?
I have button in our website, and border areas of the button is not clickable. So, i need to make sure the button is getting clicked at the center. Is it possible via selenium?
I tried using coorinates, but it is not recommended for our scenario.
xpath used : //div/button[#id='clickme']
<div class="col-lg-10 col-sm-12 p-0 pt-4">
<button class="click mb-3 " tabindex="0" id="clickme">+ Click Here</button>
</div>
Java code used to click
WebElement button = driver.findElement(By.id("clickme"));
button.click();
I guess the click is happening sometimes[2 out of 10 times] on the border where it is not clickable(hand symbol not shown) . As a result report says the click action happened, but there is no event fired on the website.
To identify the element with text as Click Here you can use either of the following Locator Strategies:
cssSelector:
"button.click#clickme"
xpath:
"//button[contains(#class, 'click') and #id='clickme'][contains(., 'Click Here')]"
how to click the radio button for
<input name="years_option" value="all_years" type="radio">
the following code does not work. please help.
WebBrowser1.Document.GetElementById("years_option").SetAttribute("all_years", "radio")
at last got the answer from another source.
WebBrowser1.Document.GetElementById("years_option").SetAttribute("checked", True)
Fyi: I'm using the selenium package for R, the selection code is equal to javascript or python so I'm asking a general selenium question.
I have a container which I have to make visible by a click, this works.
Then I try to select an element inside this container, I think I find it correctly but the click on the element only makes the popup window disappear.
Example code:
<div class="dateRanges" style="top: 275.313px; display: block;">
<a class="top dateOption CUSTOM" id="id32" href="javascript:;">
Benutzerdefinierter Zeitraum
</a>
<a class="dateOption TODAY" id="id33" href="javascript:;">
Heute
</a>
...
</div>
Element I try to find is "top dateOption CUSTOM".
My different tries which all failed:
remDr$findElement(using = 'xpath','//a[contains(#class,"top")]')$clickElement()
remDr$findElement(value = '//a[#class = "top dateOption CUSTOM"]')$clickElement()
remDr$findElements(using = 'css selector','a[class="top dateOption CUSTOM"]')[[1]]$clickElement()
I don't get any error message, the click seems to happen as the popup disappears, but the effect of the button does not.
I tried to save the object, wait a few seconds and click afterwards with no different effect.
I also tried different approaches with "idc4" with the same outcome.
Would appreciate any help, thank you.