WebDriverError:元素点击被拦截:元素在该位置不可点击其他元素将获得点击

问题描述 投票:0回答:1

在为我的UI流程之一创建自动化测试用例时,出现以下错误。我可以在UI中找到复选框元素,但是在运行程序后出现此错误。我尝试了sleep(),Loaderwait和其他解决方案,但没有任何效果。为此需要帮助。谢谢

WebDriverError:元素单击被拦截:元素在点(306,403)不可单击。其他元素将获得点击:...(会话信息:chrome = 80.0.3987.149)(驱动程序信息:chromedriver = 80.0.3987.106(f68069574609230cf9b635cd784cfb1bf81bb53a-refs / branch-heads / 3987 @ {#882}),platform = Windows NT 10.0.18363 x86_64)

```Then ("I Enter Truck ELD Provider In select ELD provider Field", async  ()=> {
  await $fk.lookup("text").click();
  await $fk.lookup("text").enter_value("Afaqy")
  await $fk.base_page.loaderWait(false);
  await $fk.base_page.click_on_first_suggestion();
});

Then("I click on Terms and conditions", async () => {
  await $fk.base_page.loaderWait(false);
  await $fk.checkbox("mat-checkbox-1-input").mouse_move();
  await $fk.checkbox("mat-checkbox-1-input").click();
});```
javascript protractor cucumber
1个回答
0
投票

选项1:

在量角器配置文件的onPrepare挂钩中使用以下内容。

onPrepare: ()=> { browser.manage().window().setSize(1600, 1000); }

选项2:

使用预期的条件等待,直到单击按钮

const EC = new protractor.ProtractorExpectedConditions();


 await browser.wait(EC.elementToBeClickable(locator for your button), 10000,' button is not clickable after 10 seconds')

选项3:

在执行点击之前,使用动作在元素上进行移动。

browser.actions().mouseMove(element).click();

(或)

browser.actions().mouseMove(element).click().perform()
© www.soinside.com 2019 - 2024. All rights reserved.