Select dropdown list - R Selenium - r

I'm trying to select a dropdown with some options useing R selenium.
Here is the code from the website
I am trying to select the option "all". I created that option on the website. I cant select that option allthogh I can select the other. Do I use xpath?
Regards
I have managed to select the original option but not the one I created myself.

To identify the element with text as all you can use the following line of code:
option_all <- remDr$findElement(using = "css selector", "div.Select-control span.Select-value-label[id^='react-select'] div")

Related

Chrome console to click

i would like to use the Chrome-console to click on a button.
So far I always used the Id, like:
$('[id="vcc-eu5"]').click();
or Title
$('[title="Delete this view and its saved rules"]').click();
of the button, but here, I can not find anything like that.
If I inspect the button I can see this:
<a class="wds-button wds-button--primary wds-button--sm apply-btn ">APPLY</a>
Is there a way trigger this button somehow? Where can I read about it?
The currently selected element in the Chrome DevTools is always available as $0.
So, you can just select it and the do $($0).click()
Or you can use a unique combination of its classes:
$('a.wds-button.wds-button--primary.apply-btn').click()

Robotframework . How I handle collapsible menu?

I try to use Click Element id=elementid in Robotframework.I have Selenium2 Library.I have a Menu collapsible.See little arrow on Entity 1 on first print screen.I try to identify the element id.I cannot see element id when I inspect this.I see only jotid that I do not think is the same.So, I am not able to use click element in order to expand my menu.I appreciate anyone's help as I am still learner.Please see also the images of a) Code, Menu, Inspected Element
You can also find it using xpath, so:
Click Element | //li[#wuid="gx:309..."]
jotid is not id, so you cannot locate it by id.
You could try keyword:
Click Link ENTITY 1 -Introduction
or find it by css:
Click element css=a[jotid='wuid:gx:4286...<the rest of it>']

How to select an option from a drop down?

When I'm trying to select any one of the options from a drop down "Birthday" on Google account creation page using .xpath, I found the xpath as follows:
.//*[#id=':a'] but it was not selecting the desired option the drop down. But, when I added /div at the end of the same xpath i.e .//*[#id=':a']/div it worked.
Can anyone explain why I should add /div at the end?
It was happened because your proper Element is //*[#id=':a']/div not just //*[#id=':a']
See the image below :-

Nightwatch Cannot Find/Click on Dropdown Option

I'm a backpacker and a programmer, trying to use the second skill to find openings in a full campsite. Rather than crawling fro scratch, I'm using the end-to-end testing framework nightwatch.js to navigate for me.
I've hit a roadblock, because nightwatch is having difficulty finding a specific element using css selectors.
Here are the elements and page:
Here is my test code:
Previous Attempts
My test code will click on the selection box with #permitTypeId. It will see that #permitTypeId option is visible. It will not see or click on any of the options when more specific values are specified. The five .click()'s are all css selectors I've already tried. None of the options are set to display:hidden or display:none. I have also tried all of the above without the .waitForElementToBeVisible() just in-case the waiting causes the dropdown to hide.
I've successfully clicked options from different dropdown menus on this website without any problem. Just this one is causing a headache.
The tests are running with the most current Selenium server and Firefox on Mac Yosemite.
tl;dr
Nightwatch.js/Selenium won't click on something from a dropdown menu.
The Path...
Cory got me thinking about jQuery and native DOM manipulation. Tried going that route and was successful selecting the correct option using Selenium's .execute() function:
.execute('document.getElementById("permitTypeId").options[1].selected=true')
However, it was not triggering the onchange event.
Saw this post which made me start thinking about using key-strokes and this one which suggested using arrow-keys to navigate down a <select> element to the option, then hitting enter.
...to the Solution
.click('select[id=permitTypeId]')
.keys(['\uE015', '\uE006'])
I've found that this is an issue with Firefox. Chrome and PhantomJS operate well clicking <option> tags.
you should be able to click like this way
browser.click('select[id="permitTypeId"] option[value="1451140610"]')
Additionally I was able to add a .click event for the specific option once I did a .click for the select. see my example below:
.click('select[name="timezone"]')
.pause(1000)
.click('option[value="America/Chicago"]') //selects the option but doesn't click
.pause(5000)
.keys(['\uE006']) //hits the enter key.
another solution:
.click('select[id="permitTypeId"]')
.waitForElementVisible("option[value='1451140610']")
.click("option[value='1451140610']")
Very simple way is to use .setValue('#element', 'value of option')

test variable title with ID - selenium ide

using selenium IDE i testing my site
in some pages i have a link with variable ID
ex : ( http://yourorder.com/135046 )
every time user click on this link site take him to process page number (135046)
so this number always changing ( variable )
so i can't use
<tr>
<td>click</td>
<td>link=yourorder.com/135046</td>
</tr>
what i can do ?
help please
you locate the element by this xpath:
"//td[contains(text(), 'link=yourorder.com')]"
There is various other options in for selection of target in SELENIUM IDE.
Sequence of selecting target value is following:
ID
NAME
LINK
DOM
CSS
XPATH
Structure of XPATH is //html tag[#property='value']
So you can try with these.
click > //html/body/div[6]/div[3]/div/div/div/table/tbody/tr/td[2]/a
thanks everyone

Resources