量角器无法使用 Safari 单击,而相同的脚本在 Chrome 和 Firefox 中运行良好
Protractor cannot click using Safari whereas same scripts working fine in Chrome and Firefox
我正在开发一个 angular 应用程序,并为 Chrome 和 Firefox 使用 directconnect。
我所有的测试脚本都运行良好,但现在我需要在 Safari 中进行 运行 相同的测试。
所以我为此使用了 webdriver-manager。
Safari 可以很好地打开我的应用程序,然后我也可以使用 sendKeys() 输入登录凭据。
但是当点击 next/login 按钮时,我得到错误 "WebDriverError: The target element is not interactable and could not be clicked"
这是非常简单的代码。
element(by.id('username')).sendKeys(username);
console.log('Click next');
element(by.buttonText('Next')).click();
console.log('Entering password');
element(by.id('password')).sendKeys(password);
console.log('Click sign in');
element(by.buttonText('Sign in')).click();
我认为这与 https://bugs.webkit.org/show_bug.cgi?id=202589 有关,其中 safari webdriver 无法点击网页上的元素。
如有不妥请指正
尝试以下使用 javascript 执行器单击元素的选项。
var signIn = element(by.buttonText('Sign in'));
await browser.executeScript('arguments[0].click()', signIn); \ This will click the element
希望对你有帮助
我正在开发一个 angular 应用程序,并为 Chrome 和 Firefox 使用 directconnect。 我所有的测试脚本都运行良好,但现在我需要在 Safari 中进行 运行 相同的测试。 所以我为此使用了 webdriver-manager。 Safari 可以很好地打开我的应用程序,然后我也可以使用 sendKeys() 输入登录凭据。 但是当点击 next/login 按钮时,我得到错误 "WebDriverError: The target element is not interactable and could not be clicked" 这是非常简单的代码。
element(by.id('username')).sendKeys(username);
console.log('Click next');
element(by.buttonText('Next')).click();
console.log('Entering password');
element(by.id('password')).sendKeys(password);
console.log('Click sign in');
element(by.buttonText('Sign in')).click();
我认为这与 https://bugs.webkit.org/show_bug.cgi?id=202589 有关,其中 safari webdriver 无法点击网页上的元素。 如有不妥请指正
尝试以下使用 javascript 执行器单击元素的选项。
var signIn = element(by.buttonText('Sign in'));
await browser.executeScript('arguments[0].click()', signIn); \ This will click the element
希望对你有帮助