【发布时间】:2019-07-25 19:16:15
【问题描述】:
我的测试用例是预约。问题是,我必须选择的所需单选按钮(表单强制)可通过 javascript 函数getTimeSlots()
这里的 webdeveloper 控制台向我展示了约会页面的单选按钮
据我了解,我转到约会页面,执行 javascript 并选择单选按钮并提交表单。但这不起作用。
Book appointment
[Tags] appointment
Input Text id:foo here is bar
Input Text id:bar here is more bar
Click Element id:requested_date
# Get date out of the datepicker
${current_date_noon} = Get Current Date result_format=%Y-%m-%d 00:00:00
${date_in_7d} = Add Time To Date ${current_date_noon} 7 days
${unixtime} = get time epoch ${date_in_7d}
${data_format} = Set Variable ${unixtime}000
Click Element xpath=//td[@data-date="${data_format}"]
# FIXME Here I try to select the radiobutton
Execute Javascript window.getTimeSlots()
#Select Radio button requested_time 19:00 - 19:30
Click Element name:requested_time
Capture Page Screenshot Screenshot-termin-buchen-{index}.png
Submit Form
当我运行代码时,我会在控制台中得到以下结果
------------------------------------------------------------------------------
Book appointment | FAIL |
StaleElementReferenceException: Message: stale element reference: element is not attached to the page document
(Session info: chrome=72.0.3626.109)
(Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux 4.9.49-moby x86_64)
------------------------------------------------------------------------------
如何使用robotframework来选择这个单选按钮?
【问题讨论】:
标签: javascript automation robotframework