r - How to use SwitchToFrame in Selenium, Rstudio? -
i have started using r (version 3.2.1) , rstudio (version 0.99.465) on windows 7.
i facing error shown below (error shown switchtoframe).
error: summary: nosuchframe detail: request switch frame not satisfied because frame not found. class: org.openqa.selenium.nosuchframeexception
i can run code individually (line line) log in currently, however, if run script, error above appear. tried add settimeout(), wait iframe appear, however, seems doesn't work well.
code
appurl <- "http://www.trademap.org/country_selcountry_mq_ts.aspx" rselenium::startserver() library("rselenium") #open headless driver phantom(), use chrome,etc pjs <- phantom() remdr<- remotedriver(browsername="phantomjs") remdr$open() remdr$navigate(appurl) #log in itc webelem<-remdr$findelement(using="css","#ctl00_menucontrol_marmenu_login")$clickelement() webelem<-remdr$settimeout(type="script",10000) webelem<-remdr$switchtoframe("iframe_login") webelem<-remdr$findelement(using="id","ctl00_pagecontent_login1_username")$sendkeystoelement (list("myusername")) webelem<-remdr$findelement(using="id","ctl00_pagecontent_login1_password")$sendkeystoelement (list("mypassword")) webelem<-remdr$findelement(using="id","ctl00_pagecontent_login1_button")$clickelement() #show screen remdr$screenshot(display = true)
i appreciate guidance in matter.
Comments
Post a Comment