質問編集履歴
1
誤字
test
CHANGED
File without changes
|
test
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
メルカリのピックアップ商品名と画像を自動保存する
|
3
3
|
|
4
4
|
発生している問題・エラーメッセージ
|
5
|
-
ModuleNotFoundError: No module named 'selenium'
|
5
|
+
ModuleNotFoundError: No module named 'selenium' と表示され、ネットでエラー内容を検索してもエラーが解決されませんでした。ご指導していたあだけるとありがたいです。
|
6
6
|
|
7
7
|
該当のソースコード
|
8
8
|
import requests
|
@@ -11,28 +11,18 @@
|
|
11
11
|
import time
|
12
12
|
import os
|
13
13
|
import chromedriver_binary
|
14
|
-
|
15
14
|
url = "https://jp.mercari.com/topics"
|
16
|
-
|
17
15
|
browser = webdriver.Chrome(ChromeDriverManager().install())
|
18
16
|
browser.get(url)
|
19
|
-
|
20
|
-
|
21
17
|
time.sleep(2)
|
22
|
-
|
23
18
|
title = browser.find_element_by_class_name("layout__SectionHeading-sc-1lyi7xi-5").text
|
24
|
-
|
25
19
|
print(title)
|
26
|
-
|
27
20
|
os.makedirs(str(title)+"画像フォルダ")
|
28
|
-
|
29
21
|
for section in browser.find_elements_by_css_selector("section.layout__StyledSection-sc-1lyi7xi-7 > section.cXuPtI"):
|
30
22
|
print(section.find_element_by_css_selector("h2").text)
|
31
23
|
print(" ")
|
32
|
-
|
33
24
|
Products = section.find_elements_by_css_selector('div.helper__Grid-sc-1vgvlgl-1 > a.ItemRow__LinkWithInlineFlex-sc-1xuhjci-8')
|
34
|
-
|
35
|
-
for Product in Products:
|
25
|
+
for Product in Products:
|
36
26
|
try:
|
37
27
|
Product_name = Product.find_element_by_css_selector('mer-item-thumbnail').get_attribute('item-name')
|
38
28
|
print(Product_name)
|