0

I use Browserstack to do the E2E testing, now I met a problem when I try to run the mobile automate script in safari on Browserstack, there will have a pop-up dialogue show when I click a button which will result in opening a new tab, the dialogue show message like this: 'this site is attempting to open a popup window', I must close it and the script can continue executing.

Now the problem is: 1. When I click the button which will trigger this pop-up dialogue, there will always show an exception in the log: 'Error while running .clickElement() protocol action: Appium error: An unknown server-side error occurred while processing the command. Original error: Did not get any response after 20s'. 2. I can use the XPath to locate the button on the pop-up dialogue and click it to close the dialogue, but it takes serval minutes, is there another way to do this operation more efficient?

const { client } = require('nightwatch-api')
const { Given, Then, When} = require('cucumber')

Given('open mobile 163 news', async function () {
    await client.url('https://3g.163.com/news/article/EJN99AOF000189FH.html?clickfrom=index2018_news_newslist#offset=0')
})

When('choose share by QQ', async function () {
    await client.waitForElementVisible('.sharelogo')
    await client.click('.sharelogo')
})

Then('the popup should show', async function () {
    await client.waitForElementVisible('.qzone')
    await client.click('.qzone')
    await client.setContext('NATIVE_APP')
    await client.source(function(res){
        console.log(res.value)
    })
    await client.useXpath()
    await client.click('//*[@name="Allow"]')
    await client.contexts(function(result) {
        client.setContext(result.value[result.value.length - 1])
        client.useCss()
    })
})
shane
  • 3
  • 2

1 Answers1

0

Have you tried adding the capability 'nativeWebTap' and setting it to the value 'true' in the test scripts?

N3M
  • 286
  • 1
  • 3
  • Can I add this 'nativeWebTap' into desiredCapabilities of nightwatch.conf.js?I try it, but still need several minutes to perform the click operation,my nightwatch.conf.js is like this: chrome_bs : { desiredCapabilities: { 'browserstack.user': 'xxx', 'browserstack.key': 'xxx', 'os': 'Windows', 'os_version': '10', 'browser': 'Chrome', 'browser_version': '70.0', 'resolution': '1920x1080', 'browserstack.debug': 'true', 'browserstack.networkLogs': 'true', 'nativeWebTap': 'true' } } – shane Jul 11 '19 at 05:47