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

回答編集履歴

4

変更3

2020/08/23 02:44

投稿

Reach
Reach

スコア735

answer CHANGED
@@ -27,10 +27,10 @@
27
27
 
28
28
 
29
29
 
30
- ### 経緯
30
+ ### 流れ
31
31
 
32
32
  ① 【pageLoadStrategy】をググる
33
- [https://www.selenium.dev/documentation/ja/webdriver/page_loading_strategy/](https://www.selenium.dev/documentation/ja/webdriver/page_loading_strategy/) で
33
+ [ページ読み込み戦略 :: Seleniumドキュメント](https://www.selenium.dev/documentation/ja/webdriver/page_loading_strategy/) で
34
34
  他言語での 記述を確認
35
35
  【Python】のサンプルコード
36
36
  options = Options()
@@ -38,11 +38,11 @@
38
38
  VBAでの Options() の記述の仕方を 探してみる
39
39
 
40
40
  ② 【vba selenium options chrome】をググる
41
- [https://www.ka-net.org/blog/?p=10705](https://www.ka-net.org/blog/?p=10705) で
41
+ [ヘッドレス ChromeをSeleniumBasicで動かしてみました ...](https://www.ka-net.org/blog/?p=10705) で
42
42
  「以前書いた記事では、.Net用のSeleniumを使い「ChromeOptions」でヘッドレスモードを指定したのですが、SeleniumBasicではChromeOptionsが用意されていないようです。
43
43
  どうすれば良いのか一瞬迷いましたが、「AddArgument」で普通にヘッドレス用のオプションを指定すれば良いようです。」
44
44
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
45
- [https://sites.google.com/a/chromium.org/chromedriver/capabilities](https://sites.google.com/a/chromium.org/chromedriver/capabilities) で
45
+ [Capabilities & ChromeOptions - WebDriver for Chrome](https://sites.google.com/a/chromium.org/chromedriver/capabilities) で
46
46
  「Recognized capabilities
47
47
  Please see Selenium documentation and W3C WebDriver standard for standard capabilities accepted by ChromeDriver. Here we only list Chrome-specific capabilities.
48
48
  ChromeOptions object
@@ -67,7 +67,7 @@
67
67
  が 使えそうではないかと 目星を付ける
68
68
 
69
69
  ④ 【addargument pageLoadStrategy】と【SetCapability pageLoadStrategy】を ググる
70
- [https://stackoverflow.com/questions/43734797/page-load-strategy-for-chrome-driver-updated-till-selenium-v3-12-0](https://stackoverflow.com/questions/43734797/page-load-strategy-for-chrome-driver-updated-till-selenium-v3-12-0) で
70
+ [Page load strategy for Chrome driver (Updated till Selenium ...](https://stackoverflow.com/questions/43734797/page-load-strategy-for-chrome-driver-updated-till-selenium-v3-12-0) で
71
71
  「dcap.setCapability("pageLoadStrategy", "normal");」から
72
72
  VBEに
73
73
  Driver.SetCapability( "pageLoadStrategy", "none")

3

追加

2020/08/23 02:44

投稿

Reach
Reach

スコア735

answer CHANGED
@@ -22,4 +22,56 @@
22
22
  ```
23
23
  実行すると
24
24
  【https://www.google.com/ 】ではなく
25
- 【data;】とでます
25
+ 【data;】とでます
26
+
27
+
28
+
29
+
30
+ ### 経緯
31
+
32
+ ① 【pageLoadStrategy】をググる
33
+ [https://www.selenium.dev/documentation/ja/webdriver/page_loading_strategy/](https://www.selenium.dev/documentation/ja/webdriver/page_loading_strategy/) で
34
+ 他言語での 記述を確認
35
+ 【Python】のサンプルコード
36
+ options = Options()
37
+ options.page_load_strategy = 'none' から
38
+ VBAでの Options() の記述の仕方を 探してみる
39
+
40
+ ② 【vba selenium options chrome】をググる
41
+ [https://www.ka-net.org/blog/?p=10705](https://www.ka-net.org/blog/?p=10705) で
42
+ 「以前書いた記事では、.Net用のSeleniumを使い「ChromeOptions」でヘッドレスモードを指定したのですが、SeleniumBasicではChromeOptionsが用意されていないようです。
43
+ どうすれば良いのか一瞬迷いましたが、「AddArgument」で普通にヘッドレス用のオプションを指定すれば良いようです。」
44
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
45
+ [https://sites.google.com/a/chromium.org/chromedriver/capabilities](https://sites.google.com/a/chromium.org/chromedriver/capabilities) で
46
+ 「Recognized capabilities
47
+ Please see Selenium documentation and W3C WebDriver standard for standard capabilities accepted by ChromeDriver. Here we only list Chrome-specific capabilities.
48
+ ChromeOptions object
49
+ Most Chrome-specific capabilities are exposed through the ChromeOptions object. In some languages, this is implemented by the ChromeOptions class. In other languages, they are stored under the goog:chromeOptions dictionary in desired capabilities.」
50
+
51
+ 【Ruby】コードの
52
+ 「caps = Selenium::WebDriver::Remote::Capabilities.chrome(
53
+ "goog:chromeOptions" => {"args" => [ "window-size=1000,800" ]})
54
+ driver = Selenium::WebDriver.for :chrome, desired_capabilities: caps」から
55
+ 「AddArgument」と「desired_capabilities」が
56
+ キーワードとなるのではないかと 推測
57
+
58
+ ③ VBEで
59
+ Dim Driver As New Selenium.WebDriver
60
+ Driver
61
+ と入力し、次に ピリオドを打鍵
62
+ すると
63
+ 入力候補一覧が 表示されるので
64
+ スクロールして 確認
65
+ ここでは
66
+ 【AddArgument】 と 【SetCapability】
67
+ が 使えそうではないかと 目星を付ける
68
+
69
+ ④ 【addargument pageLoadStrategy】と【SetCapability pageLoadStrategy】を ググる
70
+ [https://stackoverflow.com/questions/43734797/page-load-strategy-for-chrome-driver-updated-till-selenium-v3-12-0](https://stackoverflow.com/questions/43734797/page-load-strategy-for-chrome-driver-updated-till-selenium-v3-12-0) で
71
+ 「dcap.setCapability("pageLoadStrategy", "normal");」から
72
+ VBEに
73
+ Driver.SetCapability( "pageLoadStrategy", "none")
74
+ と入力
75
+ エラーなので
76
+ Driver.SetCapability "pageLoadStrategy", "none" として
77
+ コンパイル & 実行

2

編集

2020/08/23 02:02

投稿

Reach
Reach

スコア735

answer CHANGED
@@ -19,4 +19,7 @@
19
19
 
20
20
 
21
21
  End Sub
22
- ```
22
+ ```
23
+ 実行すると
24
+ 【https://www.google.com/ 】ではなく
25
+ 【data;】とでます

1

修正

2020/08/22 17:32

投稿

Reach
Reach

スコア735

answer CHANGED
@@ -1,4 +1,4 @@
1
- hatena19さんのコメントを 実装してみました
1
+ hatena19さんのコメントを参考に 実装してみました
2
2
  ```VBA
3
3
  Sub test()
4
4