讨论 » 开发
The element only has "src" "srcset" and "alt"?
<img _ngcontent-c13="" src="https://arenax-blobstorage.cdn.arkadiumhosted.com/arenax-games/BlackJack/0.37/build/resources/assets/thumbs/thumb2x.jpg" srcset="https://arenax-blobstorage.cdn.arkadiumhosted.com/arenax-games/BlackJack/0.37/build/resources/assets/thumbs/thumb2x.jpg" alt="BlackJack">
How can I implement an click to this img? I have had 0 help from wonderful google.
Assuming el is the image element, try el.dispatchEvent(new MouseEvent('click', {bubbles: true})); Depending on the site you may need to send mousedown instead of click.
el
el.dispatchEvent(new MouseEvent('click', {bubbles: true}));
mousedown
click
登录以发布留言。
The element only has "src" "srcset" and "alt"?
<img _ngcontent-c13="" src="https://arenax-blobstorage.cdn.arkadiumhosted.com/arenax-games/BlackJack/0.37/build/resources/assets/thumbs/thumb2x.jpg" srcset="https://arenax-blobstorage.cdn.arkadiumhosted.com/arenax-games/BlackJack/0.37/build/resources/assets/thumbs/thumb2x.jpg" alt="BlackJack">
How can I implement an click to this img? I have had 0 help from wonderful google.