My boss asked me to grab some data from the China in-depth accident study database. I know that I need to log in first so that I chose to use RSelenium and phantomjs to help me with my work.
I am a beginner to HTML and javascript and basically have no experience in it. To finish the task, I searched a lot from website to understand RSelenium. I can use it to log in any other website correctly. However, for this website http://114.255.167.200:8092/cidasEN/extend/util_login_list.do, I can not insert the username or password into the element by using sendKeysToElement.
For details, I successfully start Selenium server and can log in another accident database vufo.
My code is
remDr$open(silent = T)
remDr$navigate("https://www.vufo.de/interner-bereich/internal-area/?L=1")
wxbox<- remDr$findElement("name","user")
wxbox$sendKeysToElement(list(""))
wxbox<- remDr$findElement("name","pass")
wxbox$sendKeysToElement(list("")) # Type password provided from GIDAS between inverted commas " "
wxbutton<- remDr$findElement("name","submit")
wxbutton$sendKeysToElement(list(key="enter"))
I can successfully log in this website and grab the data I want if I insert the username and password. But for
remDr$open(silent = T)
remDr$navigate("http://114.255.167.200:8092/cidasEN/extend/util_login_list.do")
wxbox<- remDr$findElement("css selector","#name.b_1")
wxbox$sendKeysToElement(list("")) # Type username provided from GIDAS between inverted commas " "
wxbox<- remDr$findElement("css selector","#password.b_1")
wxbox$sendKeysToElement(list(""))
I got the error:
Error: Summary: InvalidElementState
Detail: An element command could not be completed because the element is in an invalid state (e.g. attempting to click a disabled element).
class: org.openqa.selenium.InvalidElementStateException
Further Details: run errorDetails method
I think the problem is that this website is written with td not div. You can press F12 and check the website that Chinese website is consisted with td /td.
I dont know how to insert keys to element between td /td. It seems that it is different from div. I tried to search for the answer. But I can hardly find any solutions.
Thanks.