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

質問編集履歴

1

追加

2019/11/08 14:38

投稿

Mario_11
Mario_11

スコア95

title CHANGED
File without changes
body CHANGED
@@ -24,4 +24,33 @@
24
24
  ```
25
25
 
26
26
 
27
- わかる方教えてください。
27
+ わかる方教えてください。
28
+
29
+ ```python
30
+ try:
31
+ explain = driver.find_element_by_xpath("//div[@class='MedicalCheckTabCont MedicalCheckTabWpContent tab1']").text
32
+ except:
33
+ explain = driver.find_element_by_xpath("//div[@class='MedicalCheckTabCont tab1 clearfix']").text
34
+ time.sleep(13)
35
+ print(explain)
36
+
37
+ driver.execute_script("document.getElementsByClassName('MedicalCheckTabCont tab2').style='display: none;'")
38
+
39
+ try:
40
+ point = driver.find_element_by_xpath("//div[@class='MedicalCheckTabCont MedicalCheckTabWpContent tab2']").text
41
+ except:
42
+ point = driver.find_element_by_xpath("//div[@class='MedicalCheckTabCont tab2 clearfix']").text
43
+ time.sleep(13)
44
+ print(point)
45
+
46
+ driver.execute_script("document.getElementsByClassName('MedicalCheckTabCont tab3')[0].style.display = 'none';")
47
+
48
+ try:
49
+ prevention = driver.find_element_by_xpath("//div[@class='MedicalCheckTabCont MedicalCheckTabWpContent tab3']").text
50
+ except:
51
+ prevention = driver.find_element_by_xpath("//div[@class='MedicalCheckTabCont tab3 clearfix']").text
52
+ print(prevention)
53
+
54
+ ```
55
+
56
+ explain のところは取得できているのでこの書き方で間違い無いと思うのですが、違っていたらご指摘お願いします。