Pytractor выбрасывает find_element_by_model() отсутствует 1 обязательный позиционный аргумент: 'дескриптор'
Я пишу скрипт Automated для работы с угловыми и неугловыми приложениями - фактически, когда браузер открыт, у него будет несколько перенаправлений, прежде чем он перейдет на нужную страницу с угловым приложением. Я могу справиться с этим по таймаутам и селену, но я не могу найти элементы ng-модели. Я сейчас пытаюсь:
Код обновлен
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: Сообщение: Угловое не может быть найдено на странице: ссылка: повторные попытки поиска углового превышены
Любой совет?
Заранее спасибо.
Структура веб-части, которую я пытаюсь посетить (в звездах ***********):
<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 ответ
Вместо
wd.ignoreSynchronization = True
Пытаться
browser.waitForAngularEnabled(false);
"ignoreSynchronization" устарела и больше не будет доступна. Можно не работать.