Print all hidden locator of drop down element values and select one by one of react bootstrap - selenium

We have react bootstrap app which has Dropdown field, trying to get Xpath and select drop down value however when selected drop down value html doesn't show locator or it has hidden element locator as shown in the picture.
Here in the picture, <input tag.. has aria-activedescendant="ch...demo-option-**0**"> for the first drop down value, if selected second drop down manually then it will change to < "ch...demo-option-**1**">
But this locator kind of hidden, unless mouse over on the drop down element this demo-option-0 doesn't show.
How to find this drop down element and get all values to print, select all check boxes.

Related

Selenium: how to handle dropdown overlapping that is preventing from clicking on to next element

I'm trying to select a list option from the dropdown by sending text (ie; one of the option is: "MyName") to search bar for the dropdown option, (typeAheadInputSelection). After enter the text the selection is typed on the search bar and option is highlighted, however, the highlighted drop down list does not disappear after hitting enter button.
I'm able to type text and press enter (or tab) however, the selected dropdown overlaps and unable to move onto next web element to take actions.
I have tried below code:
IWebelement webElement= driver.FindElement(By.Id("userType");
webElement.SendKeys("name" + Keys.tab)

How to get XPath of an element when it is in sub tab (Salesforce Lightning component)

In the following snippets, XPath for the drop down element in last column of accounts table is similar in Subtab and Main page.
I am using the XPath expression
//table/tbody/tr[2]/td[10]/span/div/a[2][#role="button"]
to click on drop down element. But unable to do so as it happens to appear in the previous page too.
Please help me in identifying unique irrespective of tabs.
You can use this XPATH :- (//table/tbody/tr[2]/td[10]/span/div/a[2][#role="button"])[1]

Clearing semantic ui multiselect dropdown when values are selected dynamically?

I am trying to load multiselect dropdown value based on click button action dynamically. When one click is performed value is selected and appended in the dropdown. But when I clicked next time, the dynamic values are appended to the previous value. So I decided to clear multiselect dropdown on each click.
But when values are selected dynamically, To clear dropdown
$('.ui.fluid.dropdown').dropdown('restore defaults');
$('.ui.fluid.dropdown').dropdown('clear');
Both also not working. Because of dynamic appending of data.
So my question is how to clear semantic mutiselect dropdown dynamically.
I tried to use the following code to clear the dropdown and it works fine.
var class_name = $('.ui.fluid.dropdown');
$(class_name).dropdown('clear');
$(class_name).dropdown('destroy');
$(class_name).dropdown('restore defaults');

Tosca: How to scan Dropdown textbox which disapper upon opening xScan

I have a problem in scanning a drop-down menu which disappears upon opening the xScan. I need to get the module id of the dropdown menu to verify some test steps.
Do you have any solution with this if it is not really possible to get the module id of the dropdown menu?
Open developer tools in your browser of choice (F12), navigate to the console and input the following code:
var fulldoc='';
var scrollX=0;
var scrollY=0;
document.addEventListener("keydown",function(event){
if(event.key=='q' && event.altKey){
fulldoc=document.body.outerHTML;
scrollY=window.pageYOffset;
scrollX=window.pageXOffset;
}
if(event.key=='w' && event.altKey){
document.body.outerHTML=fulldoc;
document.body.scrollTo(scrollX,scrollY);
}
});
When the window looks the way you would want to scan, press 'Alt + Q', then press 'Alt + W'.
Now your window will freeze and then you can scan your page.
To steer the objects you need to refresh your browser.
You can resolve the issue with below 2 steps
1 - Add some text in textbox which will populate the dropdown below it .
2 - Use Send Keys Module to scroll down and select the value.
I had a similar issue where we had a popup that only appeared when clicking on a text box. The solution we received from the Tricentis trainer was as follows:
Part One
1. Open your application in Chrome
2. Right click the inspect
3. In the inspector window, on the Elements tab, navigate to your html element where it should be (you can do that by clicking on the element and check that you can see the html in the element)
4. Use the debugger to add a break point there, this should pause it and you should be able to see the elements you need to steer it.
5. Once you found the element, you will need the type of element (e.g. div, span, etc), and the class name
Part two
1. Rescan your module and select any element that matches the criteria of your element selected in Part One #5
2. Identify it by only it's class name property and tag
3. Save and close
4. Edit the element in the module view by changing the class name. This should help you steer it
Note: if the element class name is not unique, you might need to use Explicit name.
Good luck

How to traverse all the element of dropdown in Selenium WebDriver?

I have a drop down on my web page and I have to traverse this drop down and select the specific one.But its not so simple, In this the traversing should be show by the hover and at last the specific element or item should be selected.(The mouse hover action should start from the first element till the required element and then select the element).
You need to look into Select, there are a couple of different ways of selecting elements from the dropdown, below is one example.
Select dropdown = new Select(<WebElement>);
dropdown.selectByVisibleText("text");