我在网页中使用RobotFramework单击元素/按钮时遇到问题。
当我启动脚本时,会显示与框架部件相关的问题。
我使用了检查代码,并选择了使用“点击元素”或“点击按钮”命令所需的元素。
这里是代码和必须单击元素的代码。
<iframe class="calculator-frame" frameborder="0" height="900px" id="lease-calculator" scrolling="no" src="/sites/default/files/web/calc/Leasing/html/lease.html?eng" style="overflow: auto;" width="670px">
#document
<!DOCTYPE html>
<html ng-app="lease">
<head>
<meta charset="utf-8">
<title>Lease Calculator</title>
<link rel="stylesheet" media="screen" href="../css/base.css" />
<script src="../js/vendor/bowser.min.js"></script>
<script src="../js/vendor/underscore-min.js"></script>
<script src="../js/vendor/angular.min.js"></script>
<script src="../js/vendor/moment.min.js"></script>
<script src="../js/vendor/moment-range.js"></script>
<script src="../js/libs1418141549195.js"></script>
<script src="../js/calculator1418141549195.js"></script>
</head>
<body ng-controller="LeaseCtrl" ng-cloak>
<div class="container" style="position: relative;">
<div class="row">
<form id="leaseForm" name="leaseForm" class="form-horizontal" novalidate>
<div class="span6" style="margin-left: -4px"><!--First Column-->
<label class="control-label">
{{ 'type-of-lease' | i18n }}
</label>
<div class="control-group">
<div class="controls controls-row">
<label class="radio" style="font-weight: normal;">
<input id="operating" type="radio" ng-model="leaseType"
value="operating" ng-change="canExecute = false"/>
{{ 'operating-lease' | i18n }}
</label>
<label class="radio" style="font-weight: normal;">
<input id="financial" type="radio" ng-model="leaseType"
value="financial" ng-change="canExecute = false"/>
{{ 'financial-lease' | i18n }}
</label>
</div>
</div>
<div class="control-group">
<label class="control-label" for="price">
{{ 'property-price' | i18n }}
</label>
<div class="controls controls-row">
<div class="input-append">
<input id="price" name="price" ng-model="price.value" data-min="{{price.min}}"
ng-change="priceChange()" class="input-small" type="text" required float/>
<span class="add-on">{{ currency }}</span>
</div>
<p class="comment">{{ 'enter-price-with-vat' | i18n }}</p>
<span class="help-block error"
ng-show="leaseForm.price.$error.float ||leaseForm.price.$error.min || leaseForm.price.$error.required">
{{ 'range-of' | i18n }} {{ price.min }}
</span>
</div>
</div>
<div class="control-group">
<label class="control-label" for="contractFee">
{{ 'contract-fee' | i18n }}
</label>
<div class="controls">
<div class="input-append">
<input id="contractFee" name="contractFee" ng-model="contractFee.value"
ng-change="contractFeeChanged()" class="input-small" type="text" required float/>
<span class="add-on">{{ currency }}</span>
</div>
<span id="contractFeeComment" class="comment nowrap">{{ contractFeeEquivalent | number }} {{ alternativeCurrency }}</span>
<span class="help-block error" id="contractFeeError" ng-model="showContractFeeError"
ng-show="showContractFeeError">
{{ 'range-of' | i18n }} {{ contractFee.min |number }}
</span>
<span></span>
</div>
</div>
<div class="control-group">
<label class="control-label" for="downpaymentType">
<span ng-show="leaseType == 'operating'">{{ 'downpayment' | i18n }}</span>
<span ng-show="leaseType == 'financial'">{{ 'first-payment' | i18n }}</span>
</label>
<div class="controls controls-row">
<input id="downpayment" name="downpayment" ng-model="downpayment.value"
data-min="{{downpayment.min}}" data-max="{{downpayment.max}}"ng-change="downpaymentChanged()"
class="input-mini" type="text" required integer/>
<select ng-model="downpaymentType" id="downpaymentType" class="input-tinny" ng-change="downpaymentTypeChanged()">
<option value="%">%</option>
<option value="{{currency}}">{{currency}}</option>
</select><br />
<span ng-show="downpaymentType == '%'" id="downpaymentComment" class="comment">
{{ downpaymentMoney | number }} {{ currency }}
</span>
<span class="help-block error"
ng-show="((leaseForm.downpayment.$error.min || leaseForm.downpayment.$error.max) && downpaymentType == '%') ||
leaseForm.downpayment.$error.required || leaseForm.downpayment.$error.integer">
{{ 'range-of' | i18n }} {{ downpayment.min }} {{ 'range-to' | i18n }} {{ downpayment.max }}
</span>
</div>
</div>
<div class="control-group">
<label class="control-label" for="contractPeriod">
{{ 'contract-period' | i18n }}
</label>
<div class="controls">
<select ng-model="contractPeriod" ng-options="period for period in periods"
class="input-mini" id="contractPeriod">
</select>
</div>
</div>
<div id="financialCol1" ng-show="leaseType == 'financial'">
<div class="control-group">
<label class="control-label" for="propertyType">
{{ 'property-type' | i18n }}
</label>
<div class="controls">
<select ng-model="propertyType" ng-change="propertyTypeChanged()"
class="input-choose" id="propertyType" ng-required="leaseType == 'financial'">
<option value="">{{ 'choose-one' | i18n }}</option>
<option value="new">{{ 'new' | i18n }}</option>
<option value="used">{{ 'used' | i18n }}</option>
</select>
</div>
</div>
</div>
</div><!-- /div .span6 First Column-->
<div class="span"><!--Middle Column-->
<div class="column-separator"></div>
</div>
<div class="span6"><!--Second Column -->
<div id="operatingCol2a" ng-show="leaseType == 'operating'">
<div class="control-group">
<label class="control-label">
{{ 'set-downpayment' | i18n }}
</label>
<div class="controls controls-row">
<label class="radio" style="font-weight: normal;">
<input type="radio" id="setDownpaymentYes" ng-change="setDownpayment = 'true'"
ng-model="setDownpayment" value="true"/>
{{ 'yes' | i18n }}
</label>
<label class="radio" style="font-weight: normal;">
<input type="radio" id="setDownpaymentNo" ng-change="setDownpayment = 'false'"
ng-model="setDownpayment" value="false"/>
{{ 'no' | i18n }}
</label>
</div>
</div>
</div>
<div id="financialCol2a" ng-show="leaseType == 'financial'">
<div class="control-group">
<label class="control-label" for="propertyYear">
{{ 'year' | i18n }}
</label>
<div class="controls">
<select ng-model="propertyYear" ng-disabled="propertyType == '' || propertyType == 'new'"
ng-options="year for year in yearsList" class="input-choose" id="propertyYear" ng-required="leaseType == 'financial'">
<option value="">{{ 'choose-one' | i18n }}</option>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="carCategory">
{{ 'car-category' | i18n }}
</label>
<div class="controls">
<select ng-model="carCategory" ng-change="modelsForBrand()"
ng-disabled="propertyYear == ''" id="carCategory" class="input-normal" ng-required="leaseType == 'financial'">
<option value="">{{ 'choose-one' | i18n }}</option>
<option value="passenger">{{ 'passenger-car' | i18n }}</option>
<option value="truck">{{ 'truck-car' | i18n }}</option>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="carBrand">
{{ 'car-brand' | i18n }}
</label>
<div class="controls">
<select id="carBrand" name="carBrand" ng-model="carBrand" ng-change="modelsForBrand()" ng-disabled="carCategory == ''"
ng-options="brand for brand in carBrands" class="input-normal" ng-required="leaseType == 'financial'">
<option value="">{{ 'choose-one' | i18n }}</option>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="carModel">
{{ 'car-model' | i18n }}
</label>
<div class="controls">
<select ng-model="carModel" ng-options="model for model in carModels"
class="input-normal" id="carModel" ng-disabled="carBrand == ''" ng-required="leaseType == 'financial'">
<option value="">{{ 'choose-one' | i18n }}</option>
</select>
</div>
</div>
</div>
<div class="control-group">
<label class="control-label" for="interestRate">
{{ 'interest-rate' | i18n }}
</label>
<div class="controls controls-row">
<div class="input-append">
<input id="interestRate" name="interestRate" ng-model="interestRate.value" data-min="{{interestRate.min}}"
data-max="{{interestRate.max}}" class="input-small" type="text" required float/>
<span class="add-on">%</span>
</div>
<span class="help-block error"
ng-show="leaseForm.interestRate.$error.min || leaseForm.interestRate.$error.max ||
leaseForm.interestRate.$error.required || leaseForm.interestRate.$error.float">
{{ 'incorrect-interest-rate' | i18n }}
</span>
</div>
</div>
<div id="operatingCol2b" ng-show="leaseType == 'operating'">
<div class="control-group">
<label class="control-label" for="residualValue">
{{ 'residual-value' | i18n }}
</label>
<div class="controls controls-row">
<input id="residualValue" name="residualValue" ng-model="residualValue.value"
data-min="{{residualValue.min}}" data-max="{{residualValue.max}}"
ng-required="leaseType == 'operating'" class="input-mini" type="text" required float/>
<select ng-model="residualValueType"
ng-change="residualValueTypeChanged()" class="input-tinny">
<option>%</option>
<option>{{currency}}</option>
</select>
<span class="help-block"
ng-show="leaseForm.residualValue.$error.float || leaseForm.residualValue.$error.min ||
leaseForm.residualValue.$error.max || leaseForm.residualValue.$error.required">
<span class="error">{{ 'range-of' | i18n }} {{ residualValue.min }}</span>
<span class="error" ng-show="residualValueType == '%'">{{ 'range-to' | i18n }} {{ residualValue.max }}</span>
</span>
</div>
</div>
<div class="control-group">
<label class="control-label" for="monthlyPayment-operating">
{{ 'monthly-payment' | i18n }}
</label>
<div class="controls controls-row">
<label id="monthlyPayment-operating" class="highlight-green">
{{ operatingMonthlyPayment | number }} {{ currency }}
</label>
</div>
</div>
</div>
<div id="financialCol2b" ng-show="leaseType == 'financial'">
<div class="control-group">
<label class="control-label" for="monthlyPayment-financial">
{{ 'monthly-payment' | i18n }}
</label>
<div class="controls controls-row">
<label id="monthlyPayment-financial" class="highlight-green">
{{ financialMonthlyPayment | number }} {{ currency }}
</label>
</div>
</div>
<div class="control-group">
<label class="control-label" for="aprHighlight">
{{ 'apr' | i18n }}
</label>
<div class="controls controls-row">
<label id="aprHighlight" class="highlight-green">
{{ financialAPR | number }}%
</label>
</div>
</div>
</div>
<div class="control-group pull-right">
<div class="controls">
<a class="button big" id="getSchedule" ng-click="getSchedule(leaseType)">
<span>{{ 'calculate' | i18n }}</span>
</a>
</div>
</div>
</div><!-- /div .span6 Second Column-->
</form><!-- /form .form-horizontal -->
</div><!-- /div .row -->
</div><!-- /div .container -->
<div class="container" style="position: relative;">
<div class="row">
<div id="alertError" class="msg-error" ng-show="showErrorMessage">
{{ 'msg-unable-to-issue-lease' | i18n }}
</div>
<div class="span12">
<br />
<p ng-bind-html-unsafe="'lease-calculator-msg' | i18n"></p>
<p ng-show="leaseType == 'financial'">{{ 'lease-calculator-insurance-msg' | i18n }}</p>
</div>
<div id="tables" class="span12" ng-show="canExecute && leaseType != 'operating'">
<div class="hr-thick"><hr /></div>
<h3>{{ 'payment-schedule' | i18n }}</h3>
<div id="table-operating" ng-show="leaseType == 'operating'">
<table class="table table-condensed table-hover table-striped">
<th style="width: 10%">{{ 'month-no' | i18n }}</th>
<th style="width: 30%;">{{ 'uncovered-outstanding-value' | i18n }} ({{ currency }})</th>
<th style="width: 15%;">{{ 'rent' | i18n }} ({{ currency }})</th>
<th style="width: 15%;">{{ 'total' | i18n }} ({{ currency }})</th>
<th style="width: 15%;">{{ 'collateral-type' | i18n }} ({{ currency }})</th>
<th style="width: 15%;">{{ 'collateral' | i18n }} ({{ currency }})</th>
<tr ng-repeat="payment in operatingSchedule">
<td>{{ operatingSchedule[$index].no }}</td>
<td>{{ operatingSchedule[$index].leftToPay }}</td>
<td>{{ operatingSchedule[$index].rent }}</td>
<td>{{ operatingSchedule[$index].total }}</td>
<td>{{ operatingSchedule[$index].downpaymentInclusion }}</td>
<td>{{ operatingSchedule[$index].downpayment }}</td>
</tr>
<tr style="font-weight: bold;">
<td class="input-mini">{{ 'total' | i18n }}</td>
<td></td>
<td>{{ operatingTotal.rent }}</td>
<td>{{ operatingTotal.total }}</td>
<td>{{ operatingTotal.downpaymentInclusion }}</td>
<td></td>
</tr>
</table>
</div><!-- /div #table-operating -->
<div id="table-financial" ng-show="leaseType == 'financial'">
<table class="table table-condensed table-hover table-striped">
<th style="width: 10%">{{ 'month-no' | i18n }}</th>
<th>{{ 'uncovered-outstanding-value' | i18n }} ({{ currency }})</th>
<th>{{ 'value-coverage-amount' | i18n }} ({{ currency }})</th>
<th>{{ 'interest-rate' | i18n }} ({{ currency }})</th>
<th>{{ 'total' | i18n }} ({{ currency }})</th>
<th>If P&C Insurance AS ({{ currency }})</th>
<th>AB „Lietuvos draudimas” ({{ currency }})</th>
<th>„PZU Lietuva” ({{ currency }})</th>
<tr ng-repeat="payment in financialSchedule">
<td>{{ financialSchedule[$index].no }}</td>
<td>{{ financialSchedule[$index].leftToPay }}</td>
<td>{{ financialSchedule[$index].downpayment }}</td>
<td>{{ financialSchedule[$index].interest }}</td>
<td>{{ financialSchedule[$index].total }}</td>
<td>{{ insurance.IF.schedule[$index] || '-' }}</td>
<td>{{ insurance.LD.schedule[$index] || '-' }}</td>
<td>{{ insurance.PZU.schedule[$index] || '-' }}</td>
</tr>
<tr style="font-weight: bold;">
<td class="input-mini">{{ 'total' | i18n }}</td>
<td></td>
<td>{{ financialTotal.downpayment }}</td>
<td>{{ financialTotal.interest }}</td>
<td>{{ financialTotal.total }}</td>
<td>{{ insurance.IF.total }}</td>
<td>{{ insurance.LD.total }}</td>
<td>{{ insurance.PZU.total }}</td>
</tr>
</table>
</div><!-- /div #table-financial -->
</div><!-- /div #tables -->
</div><!-- /div .row -->
</div><!-- /div .container -->
</body>
<script type="text/javascript">BrowserDetect.checkSupport();</script>
</html>
</iframe>
我有兴趣执行的部分是:
<div class="control-group pull-right">
<div class="controls">
<a class="button big" id="getSchedule" ng-click="getSchedule(leaseType)">
<span>{{ 'calculate' | i18n }}</span>
</a>
</div>
</div>
我用过这个:
User fill in the fields
[Documentation] The user can fill in all fields
OPEN BROWSER https://www.seb.lt/eng/private/calculator-leasing chrome
wait until page contains Calculator of leasing
select frame ${frame}
input text ${price} 500000
sleep 30s
click element ${calculate}
CLOSE BROWSER
我希望我提供所有信息,以便我能解决我的问题。
由于 安吉洛
答案 0 :(得分:0)
在firefox浏览器中试用此代码。
*** Settings ***
Library Selenium2Library
*** Variables ***
${URL} https://www.seb.lt/eng/private/calculator-leasing
${BROWSER} firefox
*** Test Cases ***
User fill in the fields
[Documentation] The user can fill in all fields
OPEN BROWSER ${URL} ${BROWSER}
Maximize Browser Window
wait until page contains Calculator of leasing
Wait Until Element Is Visible css=iframe[id="lease-calculator"] 10
Select Frame css=iframe[id="lease-calculator"]
Wait Until Element Is Visible css=input[id="price"] 10
input text css=input[id="price"] 500000
Wait Until Element Is Visible css=a[id="getSchedule"] 10
Click Element css=a[id="getSchedule"]
它对我有用。 使用geckodriver 17 for firefox。