admin管理员组文章数量:1355703
I am trying to automate some web logins through Rselenium. I've been able to automate the login successfully and also some other tasks. there's this particular form i wanted to fill, which i belive i have filled all the required field but when i click Submit, a prompt popped up and display a message like this "Please fill in the required fields."
this is my workflow so far
remote_driver <- rsDriver(browser = "firefox",
geckover = "0.33.0",
verbose = FALSE,
port = 4436L,
extraCapabilities = list(
firefoxOptions = list(args = c("--private"))))
# Assign the remote driver object to a variable
driver <- remote_driver[["client"]]
# Navigate to the website
driver$navigate(":2411/portal/agentportal/Application.html#")
Sys.sleep(5)
# Locate and input the phone number
phone_input <- driver$findElement(using = "id", value = 'gwt-debug-Phone_Number')
phone_input$clearElement()
phone_input$sendKeysToElement(list("33456616638552"))
driver$executeScript("arguments[0].dispatchEvent(new Event('change', { bubbles: true }));", list(phone_input))
Sys.sleep(1)
# Locate and input the password
password_input <- driver$findElement(using = "id", value = 'gwt-debug-PIN/Password')
password_input$clearElement()
password_input$sendKeysToElement(list("5123"))
driver$executeScript("arguments[0].dispatchEvent(new Event('change', { bubbles: true }));", list(password_input))
# Click the submit button to login
submit_button <- driver$findElement(using = "id", value = 'gwt-debug-submit_button')
submit_button$clickElement()
Sys.sleep(4)
# Click the 'Transactions' label
transaction_label <- driver$findElement(using = "xpath", value = "//div[@class='gwt-Label' and text()='Transactions']")
transaction_label$clickElement()
Sys.sleep(2)
# ================= Date Selection ===================
# Get yesterday's date
yesterday <- Sys.Date() - 1
yesterday_str <- format(yesterday, "%Y-%m-%d")
# Fill 'From Date'
from_date_input <- driver$findElement(using = "xpath", "//table[@id='gwt-debug-From_Date']//input[@type='text']")
from_date_input$clearElement()
from_date_input$sendKeysToElement(list(yesterday_str))
driver$executeScript("arguments[0].dispatchEvent(new Event('change', { bubbles: true }));", list(from_date_input))
driver$executeScript("arguments[0].dispatchEvent(new Event('blur', { bubbles: true }));", list(from_date_input))
# Fill 'To Date'
to_date_input <- driver$findElement(using = "xpath", "//table[@id='gwt-debug-To_Date']//input[@type='text']")
to_date_input$clearElement()
to_date_input$sendKeysToElement(list(yesterday_str))
driver$executeScript("arguments[0].dispatchEvent(new Event('change', { bubbles: true }));", list(to_date_input))
driver$executeScript("arguments[0].dispatchEvent(new Event('blur', { bubbles: true }));", list(to_date_input))
# Select 'ID/Phone No Participation'
id_phone_participation <- driver$findElement(using = "id", "gwt-debug-ID/Phone_No_Participation")
id_phone_participation$click()
Sys.sleep(1)
id_phone_participation$sendKeysToElement(list("All"))
driver$executeScript("arguments[0].dispatchEvent(new Event('change', { bubbles: true }));", list(id_phone_participation))
# Select 'Transaction Type'
transaction_type <- driver$findElement(using = "id", "gwt-debug-Transaction_Type")
transaction_type$click()
Sys.sleep(1)
transaction_type$sendKeysToElement(list("TOPUP"))
driver$executeScript("arguments[0].dispatchEvent(new Event('change', { bubbles: true }));", list(transaction_type))
# Select 'Transaction Status'
transaction_status <- driver$findElement(using = "id", "gwt-debug-Transaction_Status")
transaction_status$click()
Sys.sleep(1)
transaction_status$sendKeysToElement(list("All"))
driver$executeScript("arguments[0].dispatchEvent(new Event('change', { bubbles: true }));", list(transaction_status))
This is where im having issue, the submit is clicking just that im getting please fill the required field and when i click manually it does not throw such prompt
# Click Submit Button - Ensure all data is registered before clicking
Sys.sleep(3) # Ensure all elements are fully loaded
# Wait until the button is clickable
submit_button <- driver$findElement(using = "id", value = "gwt-debug-submit_button")
driver$executeScript("arguments[0].scrollIntoView();", list(submit_button)) # Scroll to the button
driver$executeScript("arguments[0].click();", list(submit_button))
This is the complete table inspection below, incase
<tbody><tr><td><div class="gwt-HTML GridFormFieldLabel">From Date:*</div></td><td><table cellspacing="0" cellpadding="0"><tbody><tr><td align="left" style="vertical-align: top;"><table cellspacing="0" cellpadding="0" dir="ltr" class="DateTimePicker" id="gwt-debug-From_Date"><tbody><tr><td align="left" style="vertical-align: top;"><input type="text" class="gwt-DateBox GridFormField"></td><td align="left" style="vertical-align: top;"><input type="text" class="gwt-TextBox GridFormField" dir="ltr"></td></tr></tbody></table></td></tr></tbody></table></td><td><div class="gwt-HTML GridFormFieldLabel">To Date:*</div></td><td><table cellspacing="0" cellpadding="0"><tbody><tr><td align="left" style="vertical-align: top;"><table cellspacing="0" cellpadding="0" dir="ltr" class="DateTimePicker" id="gwt-debug-To_Date"><tbody><tr><td align="left" style="vertical-align: top;"><input type="text" class="gwt-DateBox GridFormField"></td><td align="left" style="vertical-align: top;"><input type="text" class="gwt-TextBox GridFormField" dir="ltr"></td></tr></tbody></table></td></tr></tbody></table></td></tr><tr><td><div class="gwt-HTML GridFormFieldLabel">ID/Phone No.:</div></td><td><table cellspacing="0" cellpadding="0"><tbody><tr><td align="left" style="vertical-align: top;"><input type="text" class="gwt-TextBox GridFormField SearchPrincipalEntry PrincipalEntryBeforeActivation" id="gwt-debug-ID/Phone_No." dir="ltr"></td></tr></tbody></table></td><td><div class="gwt-HTML GridFormFieldLabel">ID/Phone No Participation:</div></td><td><table cellspacing="0" cellpadding="0"><tbody><tr><td align="left" style="vertical-align: top;"><select class="gwt-ListBox GridFormField" id="gwt-debug-ID/Phone_No_Participation"><option value="All">All</option><option value="Receiver">Receiver</option><option value="Sender">Sender</option><option value="Customer">Customer</option></select></td></tr></tbody></table></td></tr><tr><td><div class="gwt-HTML GridFormFieldLabel">Transaction Type:</div></td><td><table cellspacing="0" cellpadding="0"><tbody><tr><td align="left" style="vertical-align: top;"><select multiple="" class="gwt-ListBox GridFormField" id="gwt-debug-Transaction_Type"><option value="AWUF4U">AWUF4U</option><option value="REVERSE_CREDIT_TRANSFER">Credit transfer reversals</option><option value="CREDIT_TRANSFER">Credit transfers</option><option value="DATA_BUNDLE">Data Bundles</option><option value="GARABASA">GARABASA</option><option value="IFS_TRANSFER">IFS Transfers</option><option value="MICROCREDIT">Micro Credit</option><option value="MICROCREDIT_RECOVERY">Micro Credit Recovery</option><option value="NON_GSM_BILL">Non Gsm Bill Payment</option><option value="NON_GSM_BUNDLE">Non Gsm Bundle</option><option value="NON_GSM_TOPUP">Non Gsm Toup</option><option value="OTHER">Other transactions</option><option value="POSTPAID_TOPUP">Postpaid Topups</option><option value="REVERSE_PREPAID_TOPUP">Prepaid Topup reversals</option><option value="TOPUP">Prepaid Topups</option><option value="SPECIAL_BUNDLE">Special bundles</option><option value="PURCHASE">Voucher purchase</option></select></td></tr></tbody></table></td><td><div class="gwt-HTML GridFormFieldLabel">Transaction Status:</div></td><td><table cellspacing="0" cellpadding="0"><tbody><tr><td align="left" style="vertical-align: top;"><select class="gwt-ListBox GridFormField" id="gwt-debug-Transaction_Status"><option value="All">All</option><option value="Succeeded">Succeeded</option><option value="Failed">Failed</option></select></td></tr></tbody></table></td></tr><tr><td><div class="gwt-HTML GridFormFieldLabel">Batch Id:</div></td><td><table cellspacing="0" cellpadding="0"><tbody><tr><td align="left" style="vertical-align: top;"><input type="text" class="gwt-TextBox GridFormField" id="gwt-debug-Batch_Id"></td></tr></tbody></table></td><td><div class="gwt-HTML GridFormFieldLabel">Rows Per Page:</div></td><td><table cellspacing="0" cellpadding="0"><tbody><tr><td align="left" style="vertical-align: top;"><select class="gwt-ListBox GridFormField" id="gwt-debug-Rows_Per_Page"><option value="5">5</option><option value="10">10</option><option value="20">20</option><option value="50">50</option><option value="100">100</option></select></td></tr></tbody></table></td></tr><tr><td colspan="4" align="center"><div style="width: 100%;" class="GridFormSubmitClearHolder"><button type="button" class="gwt-Button GridFormClearButton" id="gwt-debug-clear_button">Reset</button><button type="button" class="gwt-Button GridFormSubmitButton" id="gwt-debug-submit_button">Submit</button></div></td></tr></tbody>
本文标签:
版权声明:本文标题:r - The selenium is throwing a prompt ( Fill the required field) after filling the required field - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744046390a2581603.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论