Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

popup step not working for current version of Chrome --> 69 #275

Closed
yangliu8912 opened this issue Sep 20, 2018 · 5 comments
Closed

popup step not working for current version of Chrome --> 69 #275

yangliu8912 opened this issue Sep 20, 2018 · 5 comments
Labels

Comments

@yangliu8912
Copy link

sample/9_misc is throwing error:
ERROR - cannot find file-about_tebel-LC2

@kensoh
Copy link
Member

kensoh commented Sep 20, 2018

UPDATE - in the interim if popup step is required, try opening up the new page by specifying its URL as part of the automation flow. Then interact with it normally without using popup step.


Thanks @yangliu8912 for flagging this :)

Not sure if it is related to some breaking changes in the latest Chrome release. There is now problem finding the element in the popup page. Tracing the tagui_chrome.log shows finding the target new page and attaching to it successfully. Debugging shows correct status attached, however element not found.

tagui_chrome.log

[tagui] INPUT  - 
[34] {"id":34,"method":"Target.getTargets","params":{}}
[tagui] OUTPUT - 
[34] {"id":34,"result":{"targetInfos":[{"targetId":"766F4838B1A16465B31B060A20E7CD60","type":"page","title":"Tebel.Automation","url":"http://tebel.org/index_mobile.php","attached":true,"browserContextId":"079134047CA9F67DC71ED98BD6D12773"},{"targetId":"CC302B3E56007CAA94926632294F16CC","type":"page","title":"About Tebel","url":"http://tebel.org/gist/about_tebel","attached":false,"openerId":"766F4838B1A16465B31B060A20E7CD60","browserContextId":"079134047CA9F67DC71ED98BD6D12773"},{"targetId":"C3228AE628E43939B3F406FE662CAB82","type":"background_page","title":"Chrome Media Router","url":"chrome-extension://pkedcjkdefgpdelpbcmbmeomcjbeemfm/_generated_background_page.html","attached":false,"browserContextId":"079134047CA9F67DC71ED98BD6D12773"}]}}

[tagui] INPUT  - 
[35] {"id":35,"method":"Target.attachToTarget","params":{"targetId":"CC302B3E56007CAA94926632294F16CC"}}
[tagui] OUTPUT - 
[35] {"id":35,"result":{"sessionId":"D11F8EB9EC751C831DEBCE67F1DEB1AE"}}

[tagui] INPUT  - 
[36] {"id":36,"method":"Runtime.evaluate","params":{"expression":"document.querySelectorAll('file-about_tebel-LC2').length"}}
[tagui] OUTPUT - 
[36] {"id":36,"result":{"result":{"type":"number","value":0,"description":"0"}}}

[tagui] INPUT  - 
[37] {"id":37,"method":"Runtime.evaluate","params":{"expression":"document.evaluate('//*[@id=\"file-about_tebel-LC2\"]',document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null).snapshotLength"}}
[tagui] OUTPUT - 
[37] {"id":37,"result":{"result":{"type":"number","value":0,"description":"0"}}}

Can't find documentation by Chrome on any breaking change -
https://chromedevtools.github.io/devtools-protocol/tot/Target

Can't see recent related issues reported yet on Puppeteer -
https://github.com/GoogleChrome/puppeteer/issues

No issues yet on this in another Chrome interface library -
https://github.com/cyrus-and/chrome-remote-interface/issues

Copying @Aussiroth as he is taking over supporting TagUI. Testing a flow to visit the about page works, so issue is likely new Chrome behavior. Running in default PhantomJS mode works. No clues at the moment where to troubleshoot, because the logs shows expected behavior of attaching to the new popup page, however querying an element return value 0 for not found.

@kensoh kensoh added the query label Sep 20, 2018
@kensoh kensoh changed the title popup step not working popup step not working for current version of Chrome Sep 20, 2018
@kensoh kensoh changed the title popup step not working for current version of Chrome popup step not working for current version of Chrome --> 69 Sep 20, 2018
@yangliu8912
Copy link
Author

Thank you Ken for your speedy response.
@Aussiroth
Hi Alvin, could you please help on this issue? Thank you in advance.

@kensoh
Copy link
Member

kensoh commented Sep 25, 2018

Found, looks like change in behavior of Chrome DevTools Protocol Target.attachToTarget. It previously returns a sessionId that matches the provided targetId but now it is a different value. CC @Aussiroth

Thus in tagui_header.js, the following verification condition will now fail -

if (ws_json.result.sessionId.indexOf(found_targetid) > -1)

It can be fixed by changing to following, but need more exhaustive checks -

if (ws_json.result.sessionId !== '')

In the meantime, you can go to the URL directly by specifying it instead of using the popup step.

@kensoh
Copy link
Member

kensoh commented Sep 25, 2018

@yangliu8912 in the meantime you can edit tagui/src/tagui_header.js and replace the condition

if (ws_json.result.sessionId.indexOf(found_targetid) > -1)
with if (ws_json.result.sessionId !== '')

Then share if there are any other issues that you face with the popup new window. In any case, an alternative is use default PhantomJS mode or specifying the URL to visit the page to interact with it.

@Aussiroth for your review of the possible solution.. and your thoughts if it is ok, before you commit the change accordingly. (also commit with the new positive_test.signature, will have slight change)

@Aussiroth
Copy link
Contributor

Thanks for the update Ken!
I will test it out and see if I can add the change into the code base.

Aussiroth added a commit to Aussiroth/TagUI that referenced this issue Sep 28, 2018
Instead of checking for provided sessionID, now just looks for the sessionID returned by chrome
See issue aisingapore#275 on TagUI.
kensoh added a commit to tebelorg/TagUI that referenced this issue Oct 3, 2018
kensoh added a commit to tebelorg/TagUI that referenced this issue Jul 5, 2021
kensoh added a commit to tebelorg/TagUI that referenced this issue Jul 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants