質問するログイン新規登録

回答編集履歴

2

修正2

2020/09/27 08:52

投稿

Reach
Reach

スコア735

answer CHANGED
@@ -53,9 +53,11 @@
53
53
 
54
54
  html = driver.page_source
55
55
  print('Error processing')
56
+
56
57
  except Exception as e1:
57
- print(e1 + ' Occured')
58
+ print(str(e1) + ' Occured')
58
- sys.exit(1)
59
+ html = driver.page_source
60
+
59
61
  except Exception as e2:
60
62
  print(e2)
61
63
  sys.exit(1)

1

修正

2020/09/27 08:52

投稿

Reach
Reach

スコア735

answer CHANGED
@@ -36,9 +36,9 @@
36
36
  driver.get(url)
37
37
  time.sleep(10)
38
38
 
39
- html = driver.page_source
39
+ html = ''
40
40
  try:
41
- soup = BeautifulSoup(html, "html.parser")
41
+ html = driver.page_source
42
42
  print('Normal processing')
43
43
  except UnexpectedAlertPresentException:
44
44
  print('UnexpectedAlertPresentException Occured')
@@ -51,16 +51,17 @@
51
51
  time.sleep(3)
52
52
  print("Alert accepted")
53
53
 
54
- soup = BeautifulSoup(driver.page_source, "html.parser")
54
+ html = driver.page_source
55
55
  print('Error processing')
56
56
  except Exception as e1:
57
57
  print(e1 + ' Occured')
58
+ sys.exit(1)
58
59
  except Exception as e2:
59
60
  print(e2)
61
+ sys.exit(1)
60
62
 
61
-
63
+ soup = BeautifulSoup(html, "html.parser")
62
- print('Passed')
64
+ print('Passed')
63
-
64
65
 
65
66
  errthtml = soup.find("div", attrs={"class", "errorDetail"})
66
67
  ```