Click/Enter an element in dropdown with RSelenium - rselenium

I am navigating a website using RSelenium. I have to change the value in a dropdown menu before I can proceed. The dropdown menu let's the user choose the file format of a downloadable file, which can be downloaded pressing the "export" button. The dropdown menu contains the "Excel" and "csv" and is preset to Excel. I want to switch to csv.
Using my code, I was able to access the dropdown by clicking on it. I am also able to download the selected filetype via export button. But I don't know how to change the value in the dropdown menu.
#this is the dropdown
webElem <- remDr$findElement(using = 'css', "#export_type")
#this clicks export
webElem <- remDr$findElement(using = 'css', "#tb-collapse-2 .btn-default")
webElem$clickElement()
I could probably click on "csv" by choosing the mouse position, but I want to learn a better way to do it.
I figured out that the dropdown has two possible option values (Excel and csv) by inspecting the dropdown code. I don't know how to "send" the option value to the element.
Best regards!

If someone is looking at this, I found the (very simple) solution:
webElem <- remDr$findElement(using = 'xpath', "//*[(#value = 'csv')]")
webElem$clickElement()
Notice that this using xpath instead of css. the #value is the place where you set the value. You can find that value via inspecting the page. Remember to click the element after it has been found in the dropdown.

Related

Inovua ReactDataGrid column filter context menu does not always open with one click on the column filter icon

I used Inovua ReactDataGrid to display a data table with a header row and column filters. Each column filter has a filter icon, and a click on each normally displays a column filter context menu which allows to select the type of filter (e.g. for a string filter one can choose between "contains", "starts with", "ends with", ...).
A problem arises when one clicks on a filter icon, selects a filter type (e.g. "contains" for a string filter), and after that clicks on the same filter icon again. In that case, the filter context menu does no open. One needs to click once again on the filter icon (so in total twice) to open the filter context menu once again.
Does anyone how why this happens or how to change the behaviour such that one needs to click only once on the filter icon to display the filter context menu once again?
It would also help to know how to open the filter context menu programmatically. In that case, I would be able to write a workaround. Does anyone know how to do that?
I was able to render a custom filter icon and use an event handler for the custom filter icon to know when one clicks on the icon but I was not able to open the filter context menu programmatically after that.
In the meantime I found a solution for the problem. There already exists an issue in the reactdatagrid Github repository which describes the problem I had and which is solved in reactdatagrid 5.x.x. As I used reactdatagrid 4.x the problem arosed to me. I simply updated to the current version 5.8.0 and the problem was gone.

How to remove the selected option in select tag?

I want to create a dropdown in such a way that on click of a button new dropdown is created but it should not show the selected option of the previous dropdown. I am able to create the dropdowns on button click but I can't figure out how to not show selected options of previous dropdowns.
Simply create an Array and map all your dropdowns from that. And in onClick function of button simply pop or modify the array element. I hope you got it. Feel feel to ask doubts and for more please update the source code.

How to access click event of option in React dual list box?

I am using react-dual-listbox. Here I am able to select the columns and deselect and use the selected values. But, I want to access the selected option in selected items on click of that particular item.
Ex: if 2 options are selected. If i click on second one, It should give me the value and index of the selected option. I saw something to use selectedRef for that purpose, But I am new to React.
Could anyone please help me out.
<DualListBox
canFilter
preserveSelectOrder
options={this.state.availableColumns}
selected={selectedColumns}
onClick={this.selectedRef}
onChange={this.onColumnSelected}
/>

Opening Button to open form based on combo box selection

I currently have a MS Access database of members.
I have a form that has a combo box which is populated with just the first and last names of members. (using a test database for now)
What im struggling with is how do i create a button that opens another form i have created but using the selection in the dropdown box to populate the fields in the newly opened form.
When a user from the dropdown box is selected an open is clicked i want it to open the profile form populated with their details.
pictures and access files can be found on my ftp server:
ftp://ftp.legends-gym.co.uk
User: ftpuser#legends-gym.co.uk
Pass: ftpuser
Regards
I can't access ftp site from work so can't see what you've got thus far however, the key bits you want to look at here are:
Add a button to the form and the On Click Event to open your profile form. Something along the lines of docmd.openform "frmProfile", acNormal
You need something to pass the member you've selected in the combo box to the profile form. One way might be to use OpenArgs so have a look at that
You then could use the passed variable in OpenArgs to select the data you want to fill out your profile form.
EDIT...
OK, I've had a look at the file now. Here is what you need to do to fix your problems (and a couple of extra bits which aren't causing an issue but will improve the look and feel).
On the Format of the Home form and the Member Search form, set Navigation Buttons and Record Selector to false. - This removes the unnecessary elements for a "single" form, you're not looking at records.
On the member search form, remove the binding to the members table. - You don't need to bind this form, as the recordsource of the combo is pulling the data required separately. if you look at your form before you change it, you'll notice you've got 1 of 10 records...
Also, remove the filter criteria and set filter on load to No - You were filtering the wrong form.
On the combo box, remove the after update event. - I'm not sure what that was trying to do but its completely unnecessary.
On the command button, add an onclick event which has the following code DoCmd.OpenForm "Profile", acNormal, , "ID = " & Me.Combo361 & ""
Save everything and enjoy. :)
You weren't far wrong with the filter, but it's actually a WHERE clause when opening another form - sorry, my bad misdirection. What you were doing was filtering the original form - ie the member search form. Also, you don't need to put ' quotes around the ID, it's a number not a string.
If you have problems I can probably host this fixed version somewhere for you to download.

Select2 AngularJS - How do i dynamically add a tag item?

I have a select2 input box the defined like this:
<input id="searchbox" ui-select2="autoCompleteSearch" ng-model="searchedLeafs" style="width:80%;height:36px;" class="searchbox"/>
Basically, while the user can type text into the input box (and select from the suggested autocomplete list), i would also would like to enable the user to click on an angular-based button (on the same scope) which "inject" a tag into this input box (instead of the user typing it).
Does anyone can tell me how you can do it property in angularjs? i know how to do it in the old plain select2, but coulnd't find how can you manually/dynamically add items (key/value) to the list of tags.
if you want to get a simple example, lets say that instead of you typing the tags that you want to associate with stackoverflow question, you would simply click on a link/button which would add it to the list of tags yourself.
Thx
Simply push a new object into the ng-model's array and assuming it's duck-typed to the rest of the objects it should show up fine.

Resources