如何在量角器中将不可见元素(在 appium 检查器中显示)的可见性更改为 true?

How can i change the visibility of a invisible elements (shown in appium inspector) to true in protractor?

我正在使用量角器和 Appium 测试 Angular JS 站点,. The click into the login button isn't working as i have mentionned here

loginbutton.isDisplayed().then(function(result){ console.log(result); });

我相信您可以使用原生 Javascript 更改任何属性。量角器可以 运行 JavaScript 在某些元素的上下文中。看看here.

所以答案大概是这样的:

browser
.executeScript("document.querySelector(<yourElementSelectionPath>).setAttribute('visible', 'true')");

这不是点击登录按钮没有像我预期的那样完成的起源问题,我通过改变点击量角器中的按钮时的方式解决了这个问题:

browser.actions().mouseMove(loginButton).click().perform();

这里是.

希望对您有所帮助。