2

I am new in Rselenium, I have been trying to scrape a web page with the following code:

library(reshape)
library(plyr)
library(RSelenium)

#start RSelenium
checkForServer()
startServer()
remDr <- remoteDriver()
remDr$open()

remDr$navigate(paste0("http://www.metrocuadrado.com/web/apartamentos/venta/c:bogota"))  

I want to select the area categories (Área m2:), I don't have any problems selecting most of them (for example):

remDr$findElement(using = "xpath", paste0("//select[@name = 'arearango']/option[@value = 'Hasta 60']"))$clickElement()

But with the last category:

checkForServer()
startServer()
remDr <- remoteDriver()
remDr$open()

remDr$navigate(paste0("http://www.metrocuadrado.com/web/apartamentos/venta/c:bogota"))  

remDr$findElement(using = "xpath", paste0("//select[@name = 'arearango']/option[@value = '1001 o más']"))$clickElement()

I am having an error:

 Error:      Summary: NoSuchElement
 Detail: An element could not be located on the page using the given search parameters.
 class: org.openqa.selenium.NoSuchElementException

I suppose that the problem has to do with the accent but I have not been able to solve it, how can I select this element?

1 Answer 1

2

I could solve it, it seems that R reads the word "más" as "más", I just change the letter á with á and it works

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.