当我使用js操作DOM时发生了一些奇怪的事情

问题描述 投票:-6回答:1

你可以在walmart.com页面中使用js选择一个size吗?我已经尝试了一些,但没有效果。像这个:

document.querySelector('.prod-ProductVariantType .chooser-option-current div').click();
document.querySelectorAll('.prod-ProductVariantType div.chooser-option-list div div')[1].click();

执行上面的代码后没有任何反应。页面网址:qazxsw poi

案件就像我在标题中提到的那样。

更新:我犯了一个错误,它应该是https://www.walmart.com/ip/NEW-Laptop-Cart-Table-Desk-Height-Adjustable-Portable-with-Rolling-Wheels-SPTE/794250587而不是size,再次抱歉。

javascript html dom automation puppeteer
1个回答
0
投票

如果你运行这个代码没有什么奇怪的事情(它将选择其他颜色选项):

color
© www.soinside.com 2019 - 2024. All rights reserved.