0

I am trying to scrape a web page with a JavaScript drop down menu in R. I can follow the directions listed here, but nothing happens and no errors are shown. Instead, it gives an empty list:

dropdown <- remDr$findElement(using = "id", "s2id_autogen4_search")
remDr$executeScript("arguments[0].setAttribute('class','select2-input select2-focused');", list(dropdown))
> list()

Also, nothing happens (and no console output) with dropdown$clickElement().

This is somewhat related to this post, but I need to click first to activate the drop down.

1 Answer 1

0

There was a mask over it, so I needed to find the mask, click on that, then supply arguments to the dropdown itself:

dropdown <- remDr$findElement(using = "id", "s2id_autogen4_search")
mask <- remDr$findElement(using = "xpath", "//*[@id='select2-drop-mask']") 
mask$clickElement()
dropdown$sendKeysToElement(list("l"))
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.