質問編集履歴
2
試したことに追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -68,7 +68,7 @@
|
|
68
68
|
|
69
69
|
### 試したこと
|
70
70
|
|
71
|
-
iを
|
71
|
+
iを{i}で囲んでみましたが、解決には至りませんでした。
|
72
72
|
|
73
73
|
### 補足情報(FW/ツールのバージョンなど)
|
74
74
|
|
1
エラー内容を詳細に記述
title
CHANGED
File without changes
|
body
CHANGED
@@ -9,8 +9,19 @@
|
|
9
9
|
### 発生している問題・エラーメッセージ
|
10
10
|
|
11
11
|
```
|
12
|
-
|
12
|
+
Traceback (most recent call last):
|
13
|
+
File "/xxx.py", line 32, in <module>
|
14
|
+
start_places[i] = driver.find_element_by_xpath("//*[@id='dep_list']/ul/li[i]")
|
15
|
+
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 394, in find_element_by_xpath
|
16
|
+
return self.find_element(by=By.XPATH, value=xpath)
|
17
|
+
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 976, in find_element
|
18
|
+
return self.execute(Command.FIND_ELEMENT, {
|
19
|
+
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
|
13
|
-
|
20
|
+
self.error_handler.check_response(response)
|
21
|
+
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
|
22
|
+
raise exception_class(message, screen, stacktrace)
|
23
|
+
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id='dep_list']/ul/li[i]"}
|
24
|
+
(Session info: chrome=89.0.4389.90)
|
14
25
|
```
|
15
26
|
|
16
27
|
### 該当のソースコード
|
@@ -51,11 +62,13 @@
|
|
51
62
|
else:
|
52
63
|
start_places[i].click()
|
53
64
|
time.sleep(2)
|
65
|
+
|
66
|
+
i += 1
|
54
67
|
```
|
55
68
|
|
56
69
|
### 試したこと
|
57
70
|
|
58
|
-
|
71
|
+
iを含んだものをxpathに指定することはできないのでしょうか?
|
59
72
|
|
60
73
|
### 補足情報(FW/ツールのバージョンなど)
|
61
74
|
|