如何通过量角器从日历中选择日期?

时间:2018-09-27 07:20:23

标签: javascript selenium webdriver protractor

我试图从日期选择器中选择当前日期,但是当我从日期按钮单击时,量角器测试失败。收到此错误enter image description here

 Message:
Failed: unknown error: Element <input _ngcontent-c18="" class="mat-input-element mat-form-field-autofill-control cdk-text-field-autofill-monitored ng-untouched ng-pristine ng-invalid" formcontrolname="fromDate" id="fromDate" matinput="" placeholder="From Date" readonly="" aria-haspopup="true" max="2018-09-25" aria-invalid="false" aria-required="false"> is not clickable at point (517, 268). Other element would receive the click: <div class="mat-form-field-infix">...</div>
  (Session info: chrome=68.0.3440.75)
  (Driver info: chromedriver=2.41.578700 (2f1ed5f9343c13f73144538f15c00b370eda6706),platform=Linux 4.10.0-28-generic x86_64)

日期选择器的html代码是

enter image description here

1 个答案:

答案 0 :(得分:0)

如果将==$0这样放置,您的方法将起作用:

<div class="mat-form-field-infix">
<input...></mat-datapicker> ==$0

尝试将密钥直接发送到<div class="mat-form-field-infix">