Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 99408

R - RSelenium dropdown boxes and value selection

$
0
0

I using RSelenium to fill out an online form, but I'm having an issue with selecting an input when it comes to dropdown boxes. I can access the dropdown box but can only select the value when I type in the whole value in the box. My aim is to input data via a dataset loaded into R.

For example the code below opens the website and selects 'audi' from the dropdown list. Is it possible to enter a value from a dataset(i.e. @value = dataset$cartype[1])? Have some form of like statement instead of 'audi'(i.e. @value = '%volvo%)? Or can you have a form of starts with statement(i.e @value = left(2, 'au')?

Not too sure what the best approach to this would be, so would really appreciate any ideas/thoughts on this.

Thanks in advance.

require(RSelenium) remDr <- remoteDriver(remoteServerAddr = "localhost", port = 4444, browserName = "firefox") remDr$open()

remDr$navigate("http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_select") option <- remDr$findElement(using = 'xpath', "//*/option[@value = 'audi']") option$clickElement()


Viewing all articles
Browse latest Browse all 99408

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>