예제 #1
0
    def __init__(self, uid, pswd, projectID, appWait, driver_type):
        self.uid = uid
        self.pswd = pswd
        self.projectID = projectID
        self.systemWait = appWait[0]
        self.longWait = appWait[1]
        self.midWait = appWait[2]
        self.shortWait = appWait[3]
        self.app_url = "https://accessibility.jp/libra/"
        self.index_url = "https://jis.infocreate.co.jp/"
        self.rep_index_url_base = "http://jis.infocreate.co.jp/diagnose/indexv2/report/projID/"
        self.rep_detail_url_base = "http://jis.infocreate.co.jp/diagnose/indexv2/report2/projID/"
        self.sv_mainpage_url_base = "http://jis.infocreate.co.jp/diagnose/indexv2/index/projID/"
        self.guideline_file_name = "guideline_datas.txt"
        self.rep_data = []

        # driverオプションの設定
        if driver_type == "chrome":
            options = ChromeOptions()
            options.executable_path = "/usr/bin/google-chrome"
            options.add_argument("--headless")
            options.add_argument("--dns-prefetch-disable")
            self.wd = webdriver.Chrome(options=options)
        else:
            pass

        self.wd.implicitly_wait(self.systemWait)
        self.wd.set_window_size(1280, 900)
        self.wd.get(self.app_url)
예제 #2
0
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options as ChromeOptions
from selenium.webdriver.firefox.options import Options as FirefoxOptions
from selenium.webdriver.common.alert import Alert

# browser起動
options = ChromeOptions()
options.executable_path = "/usr/bin/google-chrome"
options.add_argument("--headless")
wd = webdriver.Chrome(options=options)

# googleにアクセス
wd.get("https://www.yahoo.co.jp/")

# htmlを取得し表示する
html = wd.page_source
print(html)

# browser終了
wd.quit()
예제 #3
0
#from pyvirtualdisplay import Display
#display = Display(visible=0, size=(800, 800))  
#display.start()

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

options = Options()
options.binary_location="/usr/bin/google-chrome"
options.executable_path="/usr/bin/chromedriver"
options.add_argument('--headless')
options.add_argument('--disable-gpu')
options.add_argument('--no-sandbox')
options.add_argument('--window-size=1200x600')
driver = webdriver.Chrome(
    "/usr/bin/chromedriver",
    chrome_options=options,
    service_args=['--verbose'],
    service_log_path="{}/chromedriver.log".format("./"))

driver.get("http://localhost")
print driver.title

driver.close()
driver.quit()