I have drop down which is basically a div that is displayed in a block, When I click on a button. Each value/item in a drop down is div. Dropdown value is something like this "Click to view report <img-help>". Now my question is when i try to open the drop down and click on a item, i see that sometime <img-help> is clicked and the test is failing as clicking on image will open a help window and it is not actually selecting the item in the dropdown. How can avoid this and just click on the text?
I basically click on the button and parse through the list and then click on the value that matches on what I want to click using Selenium Java api.
updating the code that i am trying to click I am trying to click "XXXXXXXYYYYYYXXXXXX" in the div. which will refresh the page with new data.
Also wanted to mention that I am doing this in IE7. Firefox seems to be working fine.
<div class="mstrListBlockItemSelected" title="Evaluate charges to identify potential for improvement.">
<div class="mstrListBlockItemName" style="padding-left: 25px;">
XXXXXXXYYYYYYXXXXXX
<span style="width: 4px;"/>
<img style="width: 16px; height: 16px; cursor: pointer;" alt="Help" src="../plugins/custom/images/help.gif"/>
</div>
</div>
Related
I am trying to automate the assignment for toggle button on the below link :
http://way2automation.com/way2auto_jquery/accordion.php
where the icons will go on and off based on the toggle button.
The HTML code snippet for the buttons are :
<h3 class="ui-accordion-header ui-state-default ui-accordion-icons ui-corner-all" role="tab" id="ui-id-1" aria-controls="ui-id-2" aria-selected="false" aria-expanded="false" tabindex="-1"><span class="ui-accordion-header-icon ui-icon ui-icon-circle-arrow-e"></span>Section 1</h3>
I have switched to the frame already and trying to check the element using :
chromeDriver.findElement(By.xpath("//*[#id=\"ui-id-1\"]/span")).isEnabled()
however after clicking on toggel buttons the icon gets disappeared and the element is not visible at all. Hence I am getting error for the above line. Is there any way to check the icons are there or not?
I am using visual basic 12. There is a web browser in my form. I want to click it but i have a problem. The button is a javascript button. So this code doesn't work:
WebBrowser1.Document.All("button id").InvokeMember("click")
Here is the hmtl of button. How can i click it.
<p class="text-center panel-text" style="cursor: pointer;" data-bal-yenile="">32.06 KG BAL</p>
I'm looking to click the "login" button on a webpage using vba. I have managed to automate everything else, from opening the webpage to inserting the username and password. Here is the html code of the login button:
<div id="dvButton" style="width: 80px; float: right;">
<input class="button" id="btnAction" type="button" value="Login">
</div>
i thought using iedoc.getelementbyId("btnAction").click would work, however nothing happens.
Thanks for the help
I am trying to understand how the show/hide logic of a dropdown in twitter bootstrap works.
I can declare a dropdown menu in a navbar purely with HTML, and yet it seems that Javascript is involved with showing/hiding the dropdown. Also the dropdown disappears if I focus out by clicking on an unrelated area on the page.
Question part 1: Where can I find the Javascript code that is involved with Dropdowns in bootstrap?
Question part 2: Is it somehow possible to tap into the event logic and execute some custom Javascript code when a certain dropdown receives a focus out event? For example so that I can hide another (unrelated) element on the page when the dropdown looses focus?
To be more precise:
Lets say I declare a bootstrap dropdown purely in HTML (this would be inside a ul.nav.navbar-nav):
<li role="presentation" class="dropdown">
<a id="mainmenu" class="dropdown-toggle" data-toggle="dropdown"
role="button" aria-haspopup="true" aria-expanded="false">
Lectures <span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li>Action</li>
</ul>
</li>
Now somewhere else on the page I have the following HTML:
<div id="#background" style="display: none">
<img src="...">
</div>
When I click on the dropdown button bootstrap will show the dropdown, but want two additional things to happen:
The div#background should be shown
Assuming I click somewhere outside the dropdown (which will cause bootstrap to close it), I want the div#background to be hidden again.
I think it should somehow be possible to register my own callback function on some bootstrap event and show/hide my div from that callback, like so:
/* just to illustrate my idea */
hide = function(element) {
element.style.display = "none"
}
show = function(element) {
element.style.display = "block"
}
}
So how and where could I register the hide and show functions such that they get called when I open/close the dropdown and also when I click on an unrelated area on the screen, which will cause the dropdown to close.
If this is possible to achieve purely in HTML by attaching some data-* elements to my div#background then I would like to know about that too.
First:
Do you think about something like this?
$('.dropdown-toggle').dropdown();
Got it from w3schools.com
Second:
You can do call the dropdown link
$('#element').click( function(){
$('#dropdownElement').dropdown();
});
Is that what you are looking for?
In web-code I have a button:
<div id="net-equipment-button_config-1037" class="x-btn x-box-item x-toolbar-item x-btn-default-small x-noicon x-btn-noicon x-btn-default-small-noicon" style="margin: 0pt; left: 321px; top: 0px;">
<em id="net-equipment-button_config-1037-btnWrap" class="x-btn-split x-btn-split-right">
<button id="net-equipment-button_config-1037-btnEl" class="x-btn-center" autocomplete="off" role="button" hidefocus="true" type="button" aria-haspopup="true">
<span id="net-equipment-button_config-1037-btnInnerEl" class="x-btn-inner" style="">Конфигурация</span>
<span id="net-equipment-button_config-1037-btnIconEl" class="x-btn-icon x-hide-display"> </span>
</button>
</em>
</div>
If I just do by selenium click on css=#net-equipment-button_config-1037-btnWrap, a default item selected from this button, but I wanna choose another item not default, how can I do this?
P.S: This button it's a splitbutton which select default item by press on it and dropdown menu if click on a arrow
Without seeing this displayed in the browser and the CSS it is a little difficult to know for sure, but assuming that I understand it and it works the way I think it works I have a solution. You could click with offset to make it click the arrow. Selenium automatically clicks in the center of an element. You can determine how wide the button is and give the x offset as width/2 - 5 (so it will click 5 pixels from the right edge of the button). The code in C# for selenium 2 + webdriver would be this:
int xOffset = buttonWidth/2 - 5;
Actions builder = new Actions(webDriver);
builder.MoveToElement(element, xOffset, 0);
builder.Click();