You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On current main (1997670), calling ElementHandle.click({ button: 'middle' }) behaves as if the left click was triggered. For link elements this crucially doesn't result in opening a new background page, and the navigation happens on the current page.
For button: 'right' the behavior is similar in that the current page still navigates as if it was a left click, but strangely the right click is also triggered, so the context menu is shown on the new page:
This appears to be an old issue, as I was able to reproduce it on v0.3.0 and v0.4.0 as well.
Steps to reproduce
Run the following script:
import{check}from'k6';import{chromium}from'k6/x/browser';exportdefaultfunction(){constbrowser=chromium.launch({headless: false,});constcontext=browser.newContext();constpage=context.newPage();page.goto('https://test.k6.io/',{waitUntil: 'networkidle'});constel=page.$('a[href="/my_messages.php"]')el.click({button: 'middle'}).then(()=>{check(page,{'header': (p)=>{constel=p.$('h1');// el is null here, since the page has navigated away,// but we expect it to still exist, since a middle click// should open a new page in the background.console.log('h1 element:',el);if(el){returnel.textContent()=='test.k6.io';}returnfalse;},});}).finally(()=>{page.close();browser.close();});}
Notice that h1 element: null is logged and that the header check fails.
It might be easier to visualize if you add a sleep() before the check().
The text was updated successfully, but these errors were encountered:
On current
main
(1997670), callingElementHandle.click({ button: 'middle' })
behaves as if the left click was triggered. For link elements this crucially doesn't result in opening a new background page, and the navigation happens on the current page.For
![2022-07-27-181115_1920x1080_scrot](https://user-images.githubusercontent.com/1009277/181296969-3eefce00-2caa-42af-beaf-33a5bbea412b.png)
button: 'right'
the behavior is similar in that the current page still navigates as if it was a left click, but strangely the right click is also triggered, so the context menu is shown on the new page:This appears to be an old issue, as I was able to reproduce it on v0.3.0 and v0.4.0 as well.
Steps to reproduce
Run the following script:
Notice that
h1 element: null
is logged and that theheader
check fails.It might be easier to visualize if you add a
sleep()
before thecheck()
.The text was updated successfully, but these errors were encountered: