I have been struggling with the following lines of code for a few hours now and I still seem to be no closer to a solution. My code is as follows:
#create a list of all the question elements on the page
questions <- remDr$findElements(using = 'xpath', "//div[@class='question-text']")
#get the first question element in the list
question <- questions[1]
#get the text of the question element
question$getElementText()
When I debug using RStudio, it looks as though the 'questions' list is populated correctly with all 'question' elements; the 'question' item is populated correctly with the first 'question' element in the list; but many variations on the next line of code, intended to get the text within the question element, all seem to fail, giving the following error:
Error in evalq({ : attempt to apply non-function
It is possible that the error comes from a different part of the code, but very unlikely, as commenting out that line seems to leave everything else working perfectly.
I would be very grateful for any help you guys and gals might be able to provide. I'm programming in R using RSelenium - as you can probably tell, I am new to R although I do have very limited experience using Selenium in other environments.
Thanks in advance for your thoughts!