python - 使用python刮取在线商店的产品颜色
问题描述
因此,我正在搜索一家在线商店,并且在购买具有多种颜色的商品时遇到了麻烦,因为每种颜色的可用尺寸和价格都在变化,因此我需要单击每种颜色并为其提取数据。
我的问题是单击存储在列表中的每种提取颜色
colors_available = []
color_main = soup.find('li', {'class': 'facet-color-options selected'})['title']
colors_available.append(color_main)
color_remain = soup.find_all('li', {'class': 'facet-color-options deselected'})
if color_remain:
for color in color_remain:
colors_available.append(color['title']) # collecting all available colors
# hover(color.find('input')['name'])
# select('COLOR', color)
click(color['title']) # click on color
time.sleep(3)
print(f'color CLICKED is: {color}') # confirm on color clicked
print(f"Colors: {colors_available}") # print full str list of available colors
注意:还在链接上使用“选择”和“悬停”然后单击它没有用,给出以下错误:
LookupError
希望它被充分解释,并且你能尽快支持它,因为它激怒了我一段时间
解决方案
推荐阅读
- swift - Swift 3:异步队列仍在阻塞主线程/冻结应用程序?
- amazon-web-services - 我可以将 AWS 用作虚拟计算机吗?
- angular - Angular Validators:我可以根据它们的验证器为表单元素添加样式吗?
- swift - Swift 4:转义闭包只能通过值显式捕获 inout 参数
- html - 我需要按中心制作“ul”(使用 Bootstrap)
- java - 计算字符串数组中的每个元素
- python - Python - 绘图模块的对象不可调用
- python - Pyplot / Matplotlib:如何实现压缩的 y 轴
- xamarin.android - 受到错误 CS0117 的困扰:“资源 *”不包含 * 的定义
- html - Bootstrap 导航栏布局错误