I’m brand new to using selenium ide.
I’ve gotten all other parts of my coding to work.
But I’m currently having a problem with getting it to choose an option in a drop down menu.
I have the div class name for the drop down and the for the option I’d like to select but nothing I seem to try will work.
I had the same problem and solve it using this algorithm:
- click on the drop-down list
- wait until list appears
- click on list element
or another one:
- click on the drop-down list
- wait until list appears
- send keys ${ARROW_DOWN} to select element of the list
- send keys ${KEY_ENTER}
Related
I am writing a python script that should automatically download an excel file from a website. Yet, in order to generate the excel file, several drop-down lists need to be selected (eg.: Select continent, then select country, then select city... etc.). This means that I need to select one value from the drop-down menu "A" in order for the drop-down menu "B" to show the available values, once the I have selected a value in the drop-down menu "B" I can continue with drop-down "C", and so on.
The problem is that every time I select one value from one drop-down menu (say, from drop-down menu "A") the website is refreshed in order to show the values available for the subsequent drop-down menu.
So far I have been able to access the website with selenium while selecting only a value from the first drop-down menu (eg. Continent), however I am facing difficulties in dealing with the subsequent drop-down menus. Does anyone have an idea of how I could deal with this?
So far my code looks like:
from selenium import webdriver
from selenium.webdriver.support.ui import Select
driver=webdriver.Firefox()
driver.get("https://daten.ktbl.de/feldarbeit/entry.html#0")
element1=driver.find_element_by_name("hgId")
drp1=Select(element1)
drp1.select_by_visible_text("Bodenbearbeitung")
Many thanks in advance,
best
Chico
Well, found out:
wait for the ajax to load the website after the selection:
driver.implicitly_wait(20)
I am trying to create an item that is a button "show more" and when you press on it you can show a kind of context menu / drop down that all of the items in that drop down are with checkboxes and there is a search component in it too, so you can search some items in the dropdown by their name. For example: (instead of "c++,c#,Object c" it's should show "show more", i.e. static text)
I tried to use kendoContextMenu. But I don't know if it's could work because the problem with context menu is that when I will click on a checkbox the menu will close. Please advise me of a way to do that or if you have an example of code. Thanks!
The MultiSelect component might be a good starting point
https://docs.telerik.com/kendo-ui/api/javascript/ui/multiselect.
My understanding is that MultiSelect does not have a "select more than one at a time in dropdown" feature.
You might consider using a pop up window and within that implement your own custom ui that features everything you want
search term box
scrolling list of selected and selectable items
accept or cancel changes in selection
Regarding your dojo that extends drop down list, I can't code the extension for you. However, changing the dataSource assignment to a setDataSource call will populate the extension component according to the template.
// kendo.ui.DropDownList.fn.dataSource = options.testItemSource;
me.setDataSource(options.testItemSource);
I'm trying to complete a happy path e-commerce payment test but I cant seem to click on the nested element for credit card to be honest I'm not entirely sure which is the clickable element.
Any help to get this working would be appreciated.
When inputting forms, you typically want to interact with input and select elements. In this case, you can see that the visible input field is a radio button - ie <input type="radio">.
You access radio buttons using the radio method and select it by using the set method:
browser.radio(id: 'cc-payment').set
The element you want to click is the input with type radio. You should be able to do something like:
driver.find_element(:css, "input[id='cc-payment'][value='creditCard']").click
I'm curious if clicking on the parent item would resolve.
#browser.input(id: 'cc-payment').parent.click
If the div registers the click and sets the input then this might work. You should be able to manually verify this beahviour by clicking outside of the radial and seeing if it selects.
I want to simulate the user clicking on a text field, using the dropdown and selecting an item.
I can get them on the field and the dropdown working with:
click //input[#id='select_students']
keyPress //input[#id='select_student'] \40
but I can't seem to get 'picking' an item in the dropdown.
I've tried using keyPress with Keys.ENTER as the value but I get forced to put in a Target (selenium IDE in firefox this is) and I don't know what to use as the target.
I could use something that press Enter regardless regardless of target if it's available.
Below logic might be useful for you.
click css=select[id="select_students"]
select css=select[id="select_students"] label=student10
click css=option[value="student10"]
This is what I am trying to do:
Open my web application
Go to the details page to create a new entity
While creating entity, I need to select some values form the drop
down and record it on Selenium IDE
Did all the above steps, they were recorded into Selenium IDE
When I play back, it is trowing an error whenever it is trying to
run the script, where some
selections from dropdown is needed.
Have been stuck with this for quite sometime now. Tried using "focus", but it did not work as well. Can anyone help in this regards?
Get Firebug
Inspect the element to find out the class ID of that UI Element.
Command: Select
Target: class ID
Value: label=[value in drop down of this ID] For example (label=Hawaii if you're dealing with a state and that is the value in the drop down)
The code where you get that state value would look like this where you use the label.
option value="HI">Hawaii</option
That should do it.
Since I don't know your web application I am going to make a number of suggestions.
Record and replay will not always capture all of the items that it needs to reply. This is a misnomer unfortunately.
Try doing select | locator | itemInSelect
It might be worth adding a waitForX, where X is the item you are waiting for it, call before that in case that select is not loaded when the test hits that point.
I had a similar issue with post code boxes into which you enter a postcode, and then select a Store from the dropdown that appears.
The actions recorded were not completely accurate.
I ended up fixing it by using sendKeys (not relevant to you), pause and click (got the xpath of the selection)