tooltipster jQuery plugin not working if not div - tooltipster

I'm trying to use tooltipster jQuery plugin, but it doesn't work for or tag :
I've just tried this simple code :
<div id="my-tooltip">
This div has a tooltip with HTML when you hover over it!
</div>
--> div works fine
<select id="my-tooltip" name="select">
<option value="value1">Valeur 1</option>
<option value="value2" selected>Valeur 2</option>
<option value="value3">Valeur 3</option>
</select>
--> select doesn't work
<span id="my-tooltip">
test with span
</span>
--> span doesn't work
Could you please help me ?
here is my page
thank you all !

From looking at your code and site the issue is due to your multiple use of the id my-tooltip. IDs should only be used once to identify one node. A simple test can be done to prove this using jQuery, try running this on the page:
jQuery('#my-tooltip')
You'll see that only one node is returned, this is the one that has your initialised tooltip.
To fix this you'll need to change your nodes to use classes, i.e.
<div class="my-tooltip">
This div has a tooltip with HTML when you hover over it!
</div>
<select class="my-tooltip" name="select">
<option value="value1">Valeur 1</option>
<option value="value2" selected>Valeur 2</option>
<option value="value3">Valeur 3</option>
</select>
<span class="my-tooltip">test with span</span>
In your tooltipster setup, you'll want to have the following selector and options enabled:
jQuery('.my-tooltip').tooltipster({
// Original setup
content: jQuery('<span><img src="/../../../popup.png" /> <strong>This text is in bold case !</strong></span>')
// Additional options
multiple: true,
contentAsHTML: true
});
I hope this helps! :)

Related

VBA: Value change on a dropdown in IE doesn't update report

I'm automating the download of a report. There is a dropdown for status that needs changing to the value "Started". I've managed to change the value in my code but when you manually make the change the report screen for the site updates automatically. My code doesn't manage to do this.
I'm wondering if there's an extra element that might need changing. Does anyone have any idea what I'm missing?
element on the site:
<select data-bind="value: leads.overall_status, options: [null, 'not_started', 'quoted_with_quotes', 'quoted_without_quotes', 'started', 'open_accounts'], optionsText: BrokerLeadsGridModel.overall_status_renderer" style="width: 160px;vertical-align: baseline;display: inline;" class="form-control">
<option value="">Any</option>
<option value="not_started">Not Started</option>
<option value="quoted_with_quotes">Quoted</option>
<option value="quoted_without_quotes">No Quotes</option>
<option value="started">Started</option>
<option value="open_accounts">Open</option>
</select>
My Code:
Doc.getElementsByClassName("form-control")(0).Value = "started"
Did you try attribute = value css selector?
doc.querySelector("[value=started]").selected = True

VBA IE11 locking in a change to a dropdown value

I'm using VBA to open a website, login, and navigate to a certain page. There is a dropdown with 8 options.
I used this code to change the dropdown to the value I want, but it always reverts back to the default as I continue. How do I lock this change in?
Set Element = IE.Document.getElementsByName("date_range")
Element.Item(0).Value = "custom"
Here's the page code:
<div class="SelectInput">
<select class="SelectInput-select" name="date_range">
<option value="all_time">All Time</option>
<option value="today">Today</option>
<option value="yesterday">Yesterday</option>
<option value="this_month">Month to date</option>
<option value="last_month">Last Month</option>
<option value="this_year">Year to date</option>
<option value="last_year">Last year</option>
<option value="custom">Between...</option>
</select>
<div class="SelectInput-arrows">...</div>
</div>
Thanks,
you need to set the selected attribute .... ref: https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_option_selected

Unable to locate element in Selenium using correct xpath

My AUT have different tabs to test and validate various WebElements, having almost identical properties, present on these tabs.
I need to validate a dropdown searchbox and validate the options listed in the dropdown.
My script can not locate this dropdown searh box, while the xpath work perfectly fine in firebug and can identify the search box.
The error displayed is:
Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"xpath","selector":"//div[#class='btn-group']/select[#id='selectBS']"}
My script is as below:
if(Driver.findElement(By.xpath("//div[#class='btn-group']/select[#id='selectBS']")).isDisplayed());
{
System.out.println(" drop down box is displayed on the View Bill screen");
}
The HTML is as below:
<div class="col-md-5 col-sm-6 col-xs-12">
<div class="row panel panel-default panel-heading">
<div class="col-sm-4 col-xs-12">
<div class="dropdown">
<div class="btn-group">
<select id="selectBS" class="ng-pristine ng-valid ng-touched" ng-change="getBasicSearchSelectedOption()" ng-model="basicSearchSelectedOption" ng-options="option.text for option in basicSearchoptions track by option.index">
<option value="0" selected="selected" label="Search For..">Search For..</option>
<option value="1" label="Invoice Group Number">Invoice Group Number</option>
<option value="2" label="Account Number">Account Number</option>
<option value="3" label="Account Name">Account Name</option>
<option value="4" label="Type">Type</option>
</select>
</div>
</div>
</div>
Please let me know what could be wrong, and why Selenium is not able to locate the element using xpath, while its working fine in xpath.
Also, please let me know if my xpath is not correct.
Check if is present, after that, do some action so the options are visible and check that an option is visible. If these work then it may be an issue checking isDisplayed for elements with type select.

option tag not shown in firefox

I have the following code in html:
<select>
<option text="item9" value="9"></option>
<option text="item10" value="10"></option>
</select>
The select shows up as blank in firefox. There are no elements. But it works in IE. The following works in both:
<select>
<option text="item9" value="9">item9</option>
<option text="item10" value="10">item10</option>
</select>
I am using the following dojo code to create the dropdown:
dojo.byId("sel1").add(dojo.create("option", { text:optionText, value:docNode.childNodes[i].getAttribute("id") }));
How do I create
<option text="item9" value="9">item9</option>
with dojo?
All you really need is:
<select>
<option value="9">item9</option>
<option value="10">item10</option>
</select>
The text attribute is non-standard.
You can use:
dojo.byId("sel1").add(dojo.create("option",{
innerHTML:optionText,
value:docNode.childNodes[i].getAttribute("id")
}));

Jquery.tablesorter.pager Pagination VIew All option

I am trying to add view all option to the
pagesize option
Something silmilar to below:
<select class="pagesize">
<option value="10">10 per page</option>
<option value="20">20 per page</option>
<option value="all">View All</option>
</select>
for JQuery tablesorter.
How is that possible?
Please share some example or tutorial.
Thanks,
Since you control the pagesize selector, just add a really large value in the view all option:
<select class="pagesize">
<option value="10">10 per page</option>
<option value="20">20 per page</option>
<option value="500">View All</option>
</select>
I tried it and it works without causing any errors, but if you want to be more specific, you can add a bit of code to make it more exact:
$(function(){
var rows = $('table.tablesorter')[0].config.totalRows;
$('select.pagesize').find('option:contains("All")').val(rows);
});