Pytractor抛出find_element_by_model()缺少1个必需的位置参数:'descriptor'

时间:2018-07-17 06:49:31

标签: python angularjs selenium protractor selenium-iedriver

我正在编写自动脚本,以用于有角度和非角度的应用程序-实际上,一旦打开浏览器,在使用有角度的应用程序到达所需页面之前,它将有一些重定向。我可以通过超时和硒来处理它,但是我找不到ng-model元素。我正在尝试:

代码已更新

import time
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.keys import Keys
from pytractor.webdriver import Ie

wd = Ie(base_url='http://localhost:8080/base_url', script_timeout=50) #timeout does not work here by some reason
wd.ignoreSynchronization = True
wd.get('link')
time.sleep(40)

此外,由于同步页面无法进一步加载

最后我收到了:

  

AngularNotFoundException:消息:在页面上找不到Angular:链接:重试以寻找超出角度的角度

有什么建议吗?

先谢谢您。

我要参加的Web部件的结构是(以星*************表示):

<div class="table-scrollInvoice">



            <table ng-show="true" class="table-bordered tableInvoice">
                <tbody><tr>
                    <th class="thCustomInvoice"><input ng-disabled="disableAllBaseOnStage" type="checkbox" ng-model="selectedAll" ng-click="checkAll()" class="ng-pristine ng-untouched ng-valid"></th>
                    <th class="thCustomInvoice">WBSE Number</th>
                    <th class="thCustomInvoice">WBSE Description</th>
                    <th class="thCustomInvoice">Project Profile</th>
                    <th class="thCustomInvoice">Line Item - Material Code Details <a style="margin-left: 15px;" href="#" class="btn-icon icon-info" title="" data-original-title="The field 'Line Item - Material Code Details' is a mandatory field"></a></th>
                    <th class="thCustomInvoice ng-hide" ng-show="hideTimeSupply">Time of Supply</th>
                    <th class="thCustomInvoice ng-binding">Material Sales Text / Line Item Text</th>
                    <th class="thCustomInvoice" ng-show="hideQuantity">Quantity</th>
                    <th class="thCustomInvoice ng-hide" ng-show="false">Display Quantity?</th>
                    <th class="thCustomInvoice">Material Code Type</th>             
                    <th class="thCustomInvoice ng-hide" ng-show="hideAdditional">Additional Information</th>
                    <th class="thCustomInvoice ng-hide" ng-show="false">Line Item Category</th>
                    <th class="thCustomInvoice ng-hide" ng-show="false">Tax</th>
                    <th class="thCustomInvoice ng-hide" ng-show="false">Condition Type</th>         
                    <th class="thCustomInvoice">Amount</th>                                     
                    <th class="thCustomInvoice">Are you contractually obligated to bill reimbursable expenses as services revenue? (This is not common)</th>
                    <th class="thCustomInvoice">Amount of expenses to bill as fees</th>
                    <th class="thCustomInvoice ng-hide" ng-show="false">Condition Type 2</th></tr>
                <!-- ngRepeat: costObj in invoice --><tr ng-repeat="costObj in invoice" class="ng-scope">
                    <td><input class="checkBoxInvoice ng-pristine ng-untouched ng-valid" ng-disabled="disableAllBaseOnStage" type="checkbox" ng-model="costObj.selected" ng-change="checkBoxEnablrBtn()"></td>

                    <td>
                        <select class="myTLocalDrop ng-pristine ng-untouched ng-valid" ng-disabled="disableAllBaseOnStage" ng-model="costObj.selectedName" ng-change="callSapWEb(costObj.selectedName ,$index, costObj)" ng-options="wbsnum.idWbs as wbsnum.nameWbs for wbsnum in names"><option value="" class="">-- None --</option><option value="0" selected="selected" label="A6WG1001">A6WG1001</option></select></td>
                    <td><input class="myDescription ng-pristine ng-untouched ng-valid" ng-disabled="true" ng-model="costObj.Description" disabled="disabled"></td>

                    <td>
                        <select class="myTLocalDrop ng-pristine ng-untouched ng-valid" ng-disabled="true" ng-model="costObj.selectedProfile" ng-change="onChangeProf(costObj.selectedProfile , $index)" ng-options="prof.id as prof.name for prof in profile" disabled="disabled"><option value="" class="">-- None --</option><option value="0" selected="selected" label="Consulting">Consulting</option><option value="1" label="Outsourcing">Outsourcing</option></select></td>




                    <td>
                        <select ng-disabled="disableAllBaseOnStage" class="myTdropDownLineItem ng-pristine ng-untouched ng-valid" ng-model="costObj.MaterialCodeDetails" ng-change="onChangeLineItem(costObj.MaterialCodeDetails,costObj.selectedName,$index)" ng-options="materialLine.nameContract as materialLine.nameContract for materialLine in costObj.materialLineDetails"><option value="" class="">-- None --</option><option value="0" selected="selected" label="000010 - S00600 - Services">000010 - S00600 - Services</option><option value="1" label="000020 - S06600 - Reimbursable Expenses">000020 - S06600 - Reimbursable Expenses</option></select></td>

                    <td ng-show="hideTimeSupply" class="ng-hide"><input placeholder="YYYY-MM-DD" class="DatePicker ng-pristine ng-untouched ng-valid ng-valid-maxlength" type="text" maxlength="10" ng-disabled="disableAllBaseOnStage" ng-model="costObj.TimeOfSupply" ng-blur="dateValidator(costObj.TimeOfSupply,$index)"></td>



                    <td><textarea class="mySalesText ng-pristine ng-untouched ng-valid" ng-model="costObj.MaterialSales" ng-blur="everyChangeOfFieldInvoice()" ng-disabled="disableMaterialSales"></textarea></td>


             <td ng-show="hideQuantity"><input class="myTLocalDrop ng-pristine ng-untouched ng-valid" ng-disabled="disableAllBaseOnStage" ng-model="costObj.Quantity" ng-blur="getValueAmount()"></td>      

                    <td ng-show="false" class="ng-hide">
                        <select class="myTLocalDrop ng-pristine ng-untouched ng-valid" ng-model="costObj.DisplayQuantity" ng-disabled="disableAllBaseOnStage" ng-options="displayQuan.id as displayQuan.name  for displayQuan in displayQuantity"><option value="0" label="Yes">Yes</option><option value="1" selected="selected" label="No">No</option></select></td>



                    <td>
                        <select class="myTLocalDrop ng-pristine ng-untouched ng-valid" ng-model="costObj.MaterialType" ng-disabled="true" ng-change="onChangeMaterialTypeVal(costObj.MaterialType, $index)" ng-options="materialTypes.id as materialTypes.name for materialTypes in materialTypeVal" disabled="disabled"><option value="" class="">-- None --</option><option value="0" selected="selected" label="Fees">Fees</option><option value="1" label="Expenses">Expenses</option></select></td>

                    **<td ng-show="hideAdditional" class="ng-hide"><textarea class="myTLocalDropAddInformation ng-pristine ng-untouched ng-valid" ng-disabled="disableAllBaseOnStage" ng-model="costObj.Additional"></textarea></td>**
                    <td class="myTdInvoice ng-hide" ng-show="false"><input ng-model="costObj.LineItemCategory" class="ng-pristine ng-untouched ng-valid"></td>
                    <td class="myTdInvoice ng-hide" ng-show="false"><input ng-model="costObj.Tax" class="ng-pristine ng-untouched ng-valid"></td>       
                    <td class="myTdInvoice ng-hide" ng-show="false"><input ng-model="costObj.ConditionType" class="ng-pristine ng-untouched ng-valid"></td>
                    *****************<td><input class="myTLocalDrop ng-pristine ng-valid ng-touched" ng-disabled="disableAllBaseOnStage" ng-model="costObj.Amount" ng-blur="getValueAmount()"></td>********************
                    <td>
                        <select class="myTLocalDropContratually ng-pristine ng-untouched ng-valid" ng-model="costObj.Contractually" ng-change="contractuallyCall(costObj.Contractually,$index)" ng-disabled="costObj.disableContractually" ng-options="contractually for contractually in contractuallyYesNo"><option value="" class="">-- None --</option><option value="0" label="Yes">Yes</option><option value="1" selected="selected" label="No">No</option></select></td>
                    <td><input class="myTLocalDrop ng-pristine ng-untouched ng-valid" ng-change="onChangeEpenseBill(costObj.expensesTobill,$index)" ng-disabled="costObj.disableExpense" ng-model="costObj.expensesTobill" disabled="disabled"></td>            
                    <td class="myTdInvoice ng-hide" ng-show="false"><input ng-model="costObj.ConditionType2" class="ng-pristine ng-untouched ng-valid"></td></tr><!-- end ngRepeat: costObj in invoice --><tr ng-repeat="costObj in invoice" class="ng-scope">
                    <td><input class="checkBoxInvoice ng-pristine ng-untouched ng-valid" ng-disabled="disableAllBaseOnStage" type="checkbox" ng-model="costObj.selected" ng-change="checkBoxEnablrBtn()"></td>

                    <td>
                        <select class="myTLocalDrop ng-pristine ng-untouched ng-valid" ng-disabled="disableAllBaseOnStage" ng-model="costObj.selectedName" ng-change="callSapWEb(costObj.selectedName ,$index, costObj)" ng-options="wbsnum.idWbs as wbsnum.nameWbs for wbsnum in names"><option value="" class="">-- None --</option><option value="0" selected="selected" label="A6WG1001">A6WG1001</option></select></td>
                    <td><input class="myDescription ng-pristine ng-untouched ng-valid" ng-disabled="true" ng-model="costObj.Description" disabled="disabled"></td>

                    <td>
                        <select class="myTLocalDrop ng-pristine ng-untouched ng-valid" ng-disabled="true" ng-model="costObj.selectedProfile" ng-change="onChangeProf(costObj.selectedProfile , $index)" ng-options="prof.id as prof.name for prof in profile" disabled="disabled"><option value="" class="">-- None --</option><option value="0" selected="selected" label="Consulting">Consulting</option><option value="1" label="Outsourcing">Outsourcing</option></select></td>




                    <td>
                        <select ng-disabled="disableAllBaseOnStage" class="myTdropDownLineItem ng-pristine ng-untouched ng-valid" ng-model="costObj.MaterialCodeDetails" ng-change="onChangeLineItem(costObj.MaterialCodeDetails,costObj.selectedName,$index)" ng-options="materialLine.nameContract as materialLine.nameContract for materialLine in costObj.materialLineDetails"><option value="" class="">-- None --</option><option value="0" label="000010 - S00600 - Services">000010 - S00600 - Services</option><option value="1" label="000020 - S06600 - Reimbursable Expenses">000020 - S06600 - Reimbursable Expenses</option></select></td>

                    <td ng-show="hideTimeSupply" class="ng-hide"><input placeholder="YYYY-MM-DD" class="DatePicker ng-pristine ng-untouched ng-valid ng-valid-maxlength" type="text" maxlength="10" ng-disabled="disableAllBaseOnStage" ng-model="costObj.TimeOfSupply" ng-blur="dateValidator(costObj.TimeOfSupply,$index)"></td>



                    <td><textarea class="mySalesText ng-pristine ng-untouched ng-valid" ng-model="costObj.MaterialSales" ng-blur="everyChangeOfFieldInvoice()" ng-disabled="disableMaterialSales"></textarea></td>


             <td ng-show="hideQuantity"><input class="myTLocalDrop ng-pristine ng-untouched ng-valid" ng-disabled="disableAllBaseOnStage" ng-model="costObj.Quantity" ng-blur="getValueAmount()"></td>      

                    <td ng-show="false" class="ng-hide">
                        <select class="myTLocalDrop ng-pristine ng-untouched ng-valid" ng-model="costObj.DisplayQuantity" ng-disabled="disableAllBaseOnStage" ng-options="displayQuan.id as displayQuan.name  for displayQuan in displayQuantity"><option value="0" label="Yes">Yes</option><option value="1" selected="selected" label="No">No</option></select></td>



                    <td>
                        <select class="myTLocalDrop ng-pristine ng-untouched ng-valid" ng-model="costObj.MaterialType" ng-disabled="true" ng-change="onChangeMaterialTypeVal(costObj.MaterialType, $index)" ng-options="materialTypes.id as materialTypes.name for materialTypes in materialTypeVal" disabled="disabled"><option value="" class="">-- None --</option><option value="0" label="Fees">Fees</option><option value="1" label="Expenses">Expenses</option></select></td>

                    <td ng-show="hideAdditional" class="ng-hide"><textarea class="myTLocalDropAddInformation ng-pristine ng-untouched ng-valid" ng-disabled="disableAllBaseOnStage" ng-model="costObj.Additional"></textarea></td>
                    <td class="myTdInvoice ng-hide" ng-show="false"><input ng-model="costObj.LineItemCategory" class="ng-pristine ng-untouched ng-valid"></td>
                    <td class="myTdInvoice ng-hide" ng-show="false"><input ng-model="costObj.Tax" class="ng-pristine ng-untouched ng-valid"></td>       
                    <td class="myTdInvoice ng-hide" ng-show="false"><input ng-model="costObj.ConditionType" class="ng-pristine ng-untouched ng-valid"></td>
                    ******************<td><input class="myTLocalDrop ng-pristine ng-untouched ng-valid" ng-disabled="disableAllBaseOnStage" ng-model="costObj.Amount" ng-blur="getValueAmount()"></td>  *****************
                    <td>
                        <select class="myTLocalDropContratually ng-pristine ng-untouched ng-valid" ng-model="costObj.Contractually" ng-change="contractuallyCall(costObj.Contractually,$index)" ng-disabled="costObj.disableContractually" ng-options="contractually for contractually in contractuallyYesNo" disabled="disabled"><option value="" class="">-- None --</option><option value="0" label="Yes">Yes</option><option value="1" label="No">No</option></select></td>
                    <td><input class="myTLocalDrop ng-pristine ng-untouched ng-valid" ng-change="onChangeEpenseBill(costObj.expensesTobill,$index)" ng-disabled="costObj.disableExpense" ng-model="costObj.expensesTobill" disabled="disabled"></td>            
                    <td class="myTdInvoice ng-hide" ng-show="false"><input ng-model="costObj.ConditionType2" class="ng-pristine ng-untouched ng-valid"></td></tr><!-- end ngRepeat: costObj in invoice --></tbody></table>
            <br><br></div>

1 个答案:

答案 0 :(得分:1)

代替

self.pushButton_ok.clicked.connect(self.addCheckbox()) def addCheckbox(self): checkBox = QtWidgets.QCheckBox()

尝试

wd.ignoreSynchronization = True

“ ignoreSynchronization”已被弃用,最终将不再可用。有可能不起作用。