質問編集履歴
2
コードの追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
chromeでselenium(python)を使っているのですが、chromeのトップページから遷移できずにずっと待機していることがあります。(タスクスゲシューラで起動しています。)
|
2
2
|
遷移できない時はchromeを閉じさせたいのですが、どうすれば良いでしょうか?
|
3
3
|
|
4
|
-
# -*- coding: utf-8 -*-
|
5
4
|
import time
|
6
5
|
from selenium.webdriver.chrome.options import Options
|
7
6
|
from selenium import webdriver
|
1
コードの追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,2 +1,52 @@
|
|
1
1
|
chromeでselenium(python)を使っているのですが、chromeのトップページから遷移できずにずっと待機していることがあります。(タスクスゲシューラで起動しています。)
|
2
|
-
遷移できない時はchromeを閉じさせたいのですが、どうすれば良いでしょうか?
|
2
|
+
遷移できない時はchromeを閉じさせたいのですが、どうすれば良いでしょうか?
|
3
|
+
|
4
|
+
# -*- coding: utf-8 -*-
|
5
|
+
import time
|
6
|
+
from selenium.webdriver.chrome.options import Options
|
7
|
+
from selenium import webdriver
|
8
|
+
from selenium.webdriver.common.keys import Keys
|
9
|
+
from selenium.webdriver.chrome.options import Options
|
10
|
+
from selenium.webdriver.support.select import Select
|
11
|
+
from selenium.webdriver.common.by import By
|
12
|
+
from selenium.webdriver.common.keys import Keys
|
13
|
+
from selenium.webdriver.common.alert import Alert
|
14
|
+
from selenium.webdriver.support.ui import WebDriverWait
|
15
|
+
from selenium.webdriver.support import expected_conditions as EC
|
16
|
+
from selenium.common.exceptions import TimeoutException
|
17
|
+
from selenium.webdriver.common.action_chains import ActionChains
|
18
|
+
from selenium.webdriver.common.by import By
|
19
|
+
from selenium.webdriver.support.ui import WebDriverWait
|
20
|
+
from selenium.webdriver.support import expected_conditions
|
21
|
+
from pathlib import Path
|
22
|
+
|
23
|
+
options = Options()
|
24
|
+
options.add_argument('--disable-gpu');
|
25
|
+
options.add_argument('--disable-extensions');
|
26
|
+
options.add_argument('--proxy-server="direct://"');
|
27
|
+
options.add_argument('--proxy-bypass-list=*');
|
28
|
+
options.add_argument('--start-maximized');
|
29
|
+
options = webdriver.ChromeOptions()
|
30
|
+
options.add_argument('--user-data-dir=C:\Users\abcde\AppData\Local\Google\Chrome\User Data')
|
31
|
+
options.add_argument('--profile-directory=Profile 7')
|
32
|
+
|
33
|
+
driver = webdriver.Chrome(options=options)
|
34
|
+
driver.maximize_window()
|
35
|
+
driver.get("https://www.abcdefg.co.jp")
|
36
|
+
time.sleep(25)
|
37
|
+
actions = ActionChains(driver)
|
38
|
+
time.sleep(25)
|
39
|
+
driver.find_element_by_name('ACT_login').click()
|
40
|
+
time.sleep(25)
|
41
|
+
driver.find_element_by_xpath("//*[@id='nation09P']/ul/li[5]/a/img").click();
|
42
|
+
time.sleep(25)
|
43
|
+
driver.find_element_by_xpath("//*[@id='MAIN01-INNER-R']/div[8]/div/div/div/div/div/div/div[0]/div[9]/a").click();
|
44
|
+
driver.switch_to_frame(driver.find_element_by_tag_name("iframe"))
|
45
|
+
time.sleep(25)
|
46
|
+
iframe = driver.find_element_by_xpath("//*[@id='root']/div/div/div[4]/div[0]/div[1]/div").click();
|
47
|
+
time.sleep(15)
|
48
|
+
driver.switch_to.default_content()
|
49
|
+
time.sleep(5)
|
50
|
+
driver.find_element_by_xpath("//*[@id='logoutM']/a/img").click();
|
51
|
+
driver.close()
|
52
|
+
driver.quit()
|