【发布时间】:2018-08-10 05:58:40
【问题描述】:
你能在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();
执行上述代码后,什么也没发生。 页面网址:https://www.walmart.com/ip/NEW-Laptop-Cart-Table-Desk-Height-Adjustable-Portable-with-Rolling-Wheels-SPTE/794250587
这个案子就像我在标题中提到的那样。
更新:我弄错了应该是size而不是color,抱歉
再说一遍。
【问题讨论】:
-
不确定你在问什么。您想在购物页面上选择不同颜色的商品吗?
-
我迫切需要写一本类似这个问题的书。
-
@JaromandaX 我只是想用js选择一种颜色,但不费力,即使在显示颜色列表后单击颜色项。但是如果我手动单击颜色项,它就可以了。这让我很困惑:(
-
@connexo 很抱歉描述不清楚:(
-
别误会,我喜欢你的问题标题。这几乎是 - 不,它是诗。绝对是您问题中最好的部分。
标签: javascript html dom automation puppeteer