提问人:reyansh yadav 提问时间:11/8/2023 最后编辑:Helioreyansh yadav 更新时间:11/9/2023 访问量:25
如何在机器人框架中处理 Angular 的单窗口模态框
how can i handle single window modal box for angular in robot framework
问:
我正在尝试自动化一个页面,该页面在同一屏幕上打开一个新窗口模式。我已经尝试切换到,选择窗口选项,但仍然无法找到该元素。谁能帮忙 我怎样才能找到元素
代码:
*** Settings ***
Library SeleniumLibrary
*** Variables ***
${URL} http://localhost:8100/
${BROWSER} chrome
${TXTBOX_USERNAME} xpath://*[@id='content']/app-login/div[1]/div[2]/div[2]/div/form/div[1]/input
${txtbox_password} xpath://*[@id='content']/app-login/div[1]/div[2]/div[2]/div/form/div[2]/input
${BUTTON_LOGIN} xpath://*[@id='content']/app-login/div[1]/div[2]/div[2]/div/form/div[4]/a
${ERROR} Bad credentials
*** keywords ***
${application form no}= Get Value //*[@id='content']/app-deal-details/div[2]/div/app-source-details/div/form/div[1]/div/div/div/div[3]/div/input
${deal no}= Get Value xpath://*[@id='content']/app-deal-details/div[2]/div/app-source-details/div/form/div[1]/div/div/div/div[2]/div/input
${Branch}= Get Value xpath://*[@id='content']/app-deal-details/div[2]/div/app-source-details/div/form/div[1]/div/div/div/div[4]/div/ng-select/div/div/div[3]/input
${Generated By}= Get Value xpath://*[@id='content']/app-deal-details/div[2]/div/app-source-details/div/form/div[1]/div/div/div/div[5]/div
${Relationship Officer} Get Value xpath://*[@id='content']/app-deal-details/div[2]/div/app-source-details/div/form/div[1]/div/div/div/div[6]/div/input
${Line Manager1} Get Value xpath://*[@id='content']/app-deal-details/div[2]/div/app-source-details/div/form/div[1]/div/div/div/div[7]/div
[Return] ${application form no} ${deal no} ${Branch} ${Generated By} ${Relationship Officer} ${Line Manager1}
*** Test Cases ***
Verify Login Pass-Correct username and password
Open browser ${URL} ${BROWSER}
Set Selenium Implicit Wait 1s
Maximize Browser Window
Select frame removeframe
Sleep 2
Input Text ${txtbox_username} Admin
Input Password ${txtbox_password} a
Sleep 2
Click Element ${BUTTON_LOGIN}
Sleep 1
Unselect Frame
Select frame removeframe
Sleep 2
Set Focus To Element xpath://*[@id='content']/app-welcomes/div/div/app-omnifin-fin-dashboard/div/div[2]/div/div/div[1]/div
Click Element xpath://*[@id='content']/app-welcomes/div/div/app-omnifin-fin-dashboard/div/div[2]/div/div/div[1]/div
Unselect Frame
Select frame removeframe
Sleep 2
Set Focus To Element xpath://*[@id='content']/app-welcomes/div/div/app-omnifin-fin-dashboard/div/div[1]/a
Click Element xpath://*[@id='content']/app-welcomes/div/div/app-omnifin-fin-dashboard/div/div[1]/a
Unselect Frame
Select frame removeframe
Sleep 2
Set Focus To Element xpath://*[@id='content']/app-deal-details/div[2]/div/app-source-details/div/form/div[1]/div/div/div/div[8]/div/ng-select/div/span[2]
Click Element xpath://*[@id='content']/app-deal-details/div[2]/div/app-source-details/div/form/div[1]/div/div/div/div[8]/div/ng-select/div/span[2]
#Source
Input Text xpath://*[@id='content']/app-deal-details/div[2]/div/app-source-details/div/form/div[1]/div/div/div/div[8]/div/ng-select/div/div/div[3]/input EMPLOYEE REFERENCE
Scroll Element Into View xpath://*[@id='content']/app-deal-details/div[2]/div/app-source-details/div/form/div[1]/div/div/div/div[8]/div/ng-select/div/div/div[3]/input
Press Keys xpath://*[@id='content']/app-deal-details/div[2]/div/app-source-details/div/form/div[1]/div/div/div/div[8]/div/ng-select/div/div/div[3]/input ENTER
Sleep 2
# Source Description
Input Text xpath://*[@id='content']/app-deal-details/div[2]/div/app-source-details/div/form/div[1]/div/div/div/div[9]/div/ng-select/div/div/div[3]/input ADMIN
Scroll Element Into View xpath://*[@id='content']/app-deal-details/div[2]/div/app-source-details/div/form/div[1]/div/div/div/div[9]/div/ng-select/div/div/div[3]/input
Press Keys xpath://*[@id='content']/app-deal-details/div[2]/div/app-source-details/div/form/div[1]/div/div/div/div[9]/div/ng-select/div/div/div[3]/input ENTER
Sleep 1
#application form no
Set Focus To Element xpath://*[@id='content']/app-deal-details/div[2]/div/app-source-details/div/form/div[1]/div/div/div/div[3]/div/input
${application form no} Get Value xpath://*[@id='content']/app-deal-details/div[2]/div/app-source-details/div/form/div[1]/div/div/div/div[3]/div/input
Sleep 1
#Branch
Set Focus To Element xpath://*[@id='content']/app-deal-details/div[2]/div/app-source-details/div/form/div[1]/div/div/div/div[4]/div/ng-select/div/div/div[3]/input
Input Text xpath://*[@id='content']/app-deal-details/div[2]/div/app-source-details/div/form/div[1]/div/div/div/div[4]/div/ng-select/div/div/div[3]/input HEAD OFFICE
Scroll Element Into View xpath://*[@id='content']/app-deal-details/div[2]/div/app-source-details/div/form/div[1]/div/div/div/div[4]/div/ng-select/div/div/div[3]/input
Press Keys xpath://*[@id='content']/app-deal-details/div[2]/div/app-source-details/div/form/div[1]/div/div/div/div[4]/div/ng-select/div/div/div[3]/input ENTER
${Branch} Get Value xpath://*[@id='content']/app-deal-details/div[2]/div/app-source-details/div/form/div[1]/div/div/div/div[4]/div/ng-select/div/div/div[3]/input
Sleep 1
#Generated By
Set Focus To Element xpath://*[@id='content']/app-deal-details/div[2]/div/app-source-details/div/form/div[1]/div/div/div/div[5]/div
${Generated By} Get Value xpath://*[@id='content']/app-deal-details/div[2]/div/app-source-details/div/form/div[1]/div/div/div/div[5]/div
Sleep 1
#Relationship Officer(RO)
Set Focus To Element xpath://*[@id='content']/app-deal-details/div[2]/div/app-source-details/div/form/div[1]/div/div/div/div[6]/div/input
${Relationship Officer} Get Value xpath://*[@id='content']/app-deal-details/div[2]/div/app-source-details/div/form/div[1]/div/div/div/div[6]/div/input
Sleep 1
#Line Manager1
Set Focus To Element xpath://*[@id='content']/app-deal-details/div[2]/div/app-source-details/div/form/div[1]/div/div/div/div[7]/div
${Line Manager1} Get Value xpath://*[@id='content']/app-deal-details/div[2]/div/app-source-details/div/form/div[1]/div/div/div/div[7]/div
Sleep 1
#save
Click Element xpath://*[@id='content']/app-deal-details/div[2]/div/app-source-details/div/form/div[2]/p/button/span
Sleep 2
# get deal no
Set Focus To Element xpath://*[@id='content']/app-deal-details/div[2]/div/app-source-details/div/form/div[1]/div/div/div/div[2]/div/input
${deal no} Get Value xpath://*[@id='content']/app-deal-details/div[2]/div/app-source-details/div/form/div[1]/div/div/div/div[2]/div/input
#Click on Personal
Sleep 5s
Set Focus To Element xpath://*[@id='container']/li[2]/a
Click Element xpath://*[@id='container']/li[2]/a
#Click on Add More
Set Focus To Element xpath://*[@id='content']/app-deal-details/div[2]/div/app-sales-personal-details/div/div[1]/div/button/span
Click Element xpath://*[@id='content']/app-deal-details/div[2]/div/app-sales-personal-details/div/div[1]/div/button/span
Unselect Frame
Sleep 2
Select Frame removeframe
#Adding Applicant
#Select From List By Label xpath://*[@id='ion-overlay-5']/app-add-customer-popup/ion-content/div/div/div/div[1]/div[1]/div/label APPLICANT
# Scroll Element Into View xpath://*[@id='ion-overlay-5']/app-add-customer-popup/ion-content/div/div/div/div[1]/div[1]/div/label
# Select Window xpath://*[@id='ion-overlay-5']/app-add-customer-popup/ion-content/div/div/div/div[1]/div[1]/div/label
# Wait Until Page Contains Element xpath://*[@id='ion-overlay-5']/app-add-customer-popup/ion-content/div/div/div/div[1]/div[1]/div/label
#Log To Console ${handles}
# Select Window Modal Window Title
# Get Window Names
#Title Should Be Add Customer
Set Focus To Element xpath:/html/body/allow-navigation/app-root/ion-router-outlet/app-deal-details/app-sales-sheet-header/div/nav/ol/li/a
Scroll Element Into View xpath:/html/body/allow-navigation/app-root/ion-router-outlet/app-deal-details/app-sales-sheet-header/div/nav/ol/li/a
Press Keys xpath:/html/body/allow-navigation/app-root/ion-router-outlet/app-deal-details/app-sales-sheet-header/div/nav/ol/li/a ENTER
#First Name
Set Focus To Element xpath://*[@id='ion-overlay-2']/app-add-customer-popup/ion-content/div/div/div/form/div/div/div[3]/div/input
Input Text xpath://*[@id='ion-overlay-10']/app-add-customer-popup/ion-content/div/div/div/form/div/div/div[3]/div/input Rahul
#Last name
Set Focus To Element xpath://*[@id='ion-overlay-2']/app-add-customer-popup/ion-content/div/div/div/form/div/div/div[5]/div/input
Input Text xpath://*[@id='ion-overlay-2']/app-add-customer-popup/ion-content/div/div/div/form/div/div/div[5]/div/input Yadav
----单击此添加更多后,将打开一个新的模式框
答: 暂无答案
评论