0

I'm trying to automate login with Rselenium in Rstudio please see below

remote_driver <- rsDriver(browser = "firefox", 
                          geckover = "0.33.0",
                          verbose = FALSE, 
                          port = 4457L)

# Assign the remote driver object to a variable
driver <- remote_driver[["client"]]

driver$navigate("https://etopup.gowold.com:2233/agentport/agentportal/Application.html#")

I can easily locate the username and the userID without any error:

Sys.sleep(2)
reseller_id_input <- driver$findElement(using = 'id', "gwt-debug-Reseller_ID")
# Supply a value to the input field (e.g., "your_reseller_id")
reseller_id_input$sendKeysToElement(list("Napset"))

user_id_input <- driver$findElement(using = 'xpath', "//div[contains(text(),'User ID:')]//following::input[1]")
#Supply a value to the input field (e.g., "your_user_id")
user_id_input$sendKeysToElement(list("Yodigzy"))

The problem is the password part, when I locate the password field and send in password text, it doesn't reflect in the password field and does not show or display any error:

#Locate the Password input field
password_field <- driver$findElement(using = "id", value = "gwt-debug-Password")
password_field$sendKeysToElement(list("your-password"))

Without this password, I can't proceed to login. Is there any logic behind this or what? I really need help with this.

Thanks

1 Answer 1

1

The problem is that there are two INPUT fields on the page with the ID of "gwt-debug-Password". The first one on the page is not visible, that's why you are seeing this behavior.

One way to get around this is to use findElements() (plural) and then get the second element. I don't know R but after some googling I think it might be something like,

password_field <- driver$findElements(using = "id", value = "gwt-debug-Password")
password_field[[2]]$sendKeysToElement(list("your-password"))
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for your cintribution, it helps alot.

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.