回答編集履歴
1
import を追加
answer
CHANGED
@@ -20,6 +20,9 @@
|
|
20
20
|
`find_element()`などで1つづつ取得する時は`NoSuchElementException`が発生したかどうかを確認すれば要素があるかわかります。
|
21
21
|
|
22
22
|
```python
|
23
|
+
from selenium.webdriver.common.by import By
|
24
|
+
from selenium.common.exceptions import NoSuchElementException
|
25
|
+
|
23
26
|
def find(driver, selector):
|
24
27
|
try:
|
25
28
|
return driver.find_element(By.CSS_SELECTOR, selector)
|