0

I have following Rselenum code:

library(RSelenium)

remDr <- remoteDriver(remoteServerAddr = "192.168.99.100", port = 4445L, browserName = "chrome")
remDr$open()

# Simulate browser session and fill out form
remDr$navigate("https://oss.uredjenazemlja.hr/public/lrServices.jsp?action=publicLdbExtract")

remDr$findElement(using = "xpath", 
                  "//*[@id='x-auto-29']/input")$sendKeysToElement(list("Beli Manastir", key = "enter"))
Sys.sleep(1L)
remDr$findElement(using = "xpath", 
                  "//*[@id='x-auto-30']/input")$clickElement()
Sys.sleep(1L)
remDr$findElement(using = "xpath", 
                  "//*[@id='x-auto-30']/input")$sendKeysToElement(list("Baranjsko", key = "enter"))
Sys.sleep(1L)
remDr$findElement(using = "id", 
                  "x-auto-32")$sendKeysToElement(list("1"))
Sys.sleep(1L)
remDr$findElement(using = "xpath", 
                  "//*[@id='x-auto-33']/input")$clickElement()
Sys.sleep(1L)
remDr$findElement(using = "xpath", 
                  "//*[@id='x-auto-35']/div[2]")$clickElement()
Sys.sleep(1L)
remDr$findElement(using = "xpath", 
                  "//*[@id='x-auto-14']/tbody/tr/td[2]/em/button")$clickElement()

As you can see new "window" pop up. If I try to select any of the elements in new window but it returns and error. How could I download captcha picture or wright something in text box? I tried windows handlers, but it's not a new window.

EDIT:

I have found on several places that I should use javascript to click hidden elements. I tryed:

script <- "return document.getElementById('x-auto-135').hidden;"
remDr$executeScript(script, args = list())

but get an error:

Error:   Summary: UnknownError
     Detail: An unknown server-side error occurred while processing the command.
     class: java.lang.NullPointerException
     Further Details: run errorDetails method
Mislav
  • 1,533
  • 16
  • 37

1 Answers1

0

I have finally find the solution:

remDr$findElement(
  using = "css selector",
  ".x-window input[class=' x-form-field x-form-text ']")$sendKeysToElement(list("ded24", key = "enter"))
Mislav
  • 1,533
  • 16
  • 37