Не могу найти по xpath, потому что его Xpath всегда меняется - PullRequest
0 голосов
/ 20 июня 2019

I Попытка найти элемент ввода ниже (также на рисунке), по его содержанию: enter image description here

<input _ngcontent-c39="" autocomplete="off" class="remove-input-styling mat-input-element mat-form-field-autofill-control cdk-text-field-autofill-monitored ng-pristine ng-valid ng-touched" matinput="" readonly="true" ng-reflect-owl-date-time="[object Object]" ng-reflect-min="Thu Jun 20 2019 09:38:58 GMT+0" ng-reflect-select-mode="range" ng-reflect-readonly="" ng-reflect-dt-picker="[object Object]" aria-haspopup="true" min="2019-06-20T06:38:58.206Z" id="mat-input-23" aria-invalid="false" aria-required="false">

1.Пробовал что -

self.driver.find_element_by_xpath("//input[contains(.,'remove-input-styling mat-input-element mat-form-field-autofill-control cdk-text-field-autofill-monitored ng-pristine ng-valid ng-touched')]")

и

Пробовал, что -
WebDriverWait(self.driver, 30).until(EC.presence_of_element_located((By.XPATH, "//input[@class='remove-input-styling mat-input-element mat-form-field-autofill-control cdk-text-field-autofill-monitored ng-untouched ng-pristine ng-valid'][contains(.,' ')]")))

Это исполняемая строка:

self.driver.execute_script("arguments[0].click();", self.date_element)

В обоих случаях я не нашел x-path

1 Ответ

0 голосов
/ 20 июня 2019

Вы пробовали этот Xpath?

//input[contains(@id,'mat-input')]
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...