0

I'm trying to scrape this site but I can't get any results. My code is:

library(RSelenium)

url <- "https://derbis.dernekler.gov.tr/IstatistikDerneklerWeb/IlFaaliyetAlaniDernekler"

driver <- rsDriver(browser=c("firefox"), port = 4445L)
remote_driver <- driver[["client"]]
remote_driver$navigate(url)

option <- remote_driver$findElement(using = 'xpath',
                                    "//select[@id='cbIl']/option[@value='ADANA']")

option$clickElement()

enter image description here

My aim is to get the table by clicking the button after selecting the inputs I want. I'll write them in a loop and try all kinds of combinations and get the table, but I did not get the part I mentioned. Can you show me an example?

Any help would be much appreciated.

youraz
  • 463
  • 4
  • 14

1 Answers1

-1

Looks like the option value is 1, not 'ADANA' Rather it seems to be @value="1"

If you instead mean to look for the option that has text content 'ADANA', this is a question that has been asked and answered before, for example here:

Xpath: how to select an option based on its text not value property?

Sirius
  • 5,224
  • 2
  • 14
  • 21
  • While technically correct, I'm inferring from the OP that the intent is to choose whichever `option` displays `"ADANA"`, regardless of its `value=`. (I'm inferring that the association of Adana to 1 is convenient enumeration: since this is selecting "cities", I don't think looking for `'1'` is the safest option.) – r2evans Feb 28 '21 at 14:38
  • Well, yes. I was hoping it would jump the OP on a track to the correct answer. – Sirius Feb 28 '21 at 23:26