blob: 9d9ab41f14252bf4c82bd731d3dcbffd95fc3d51 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#!/usr/bin/env python3
"""
Stub used to just test how selenium triggers chrome
"""
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait, Select
from selenium.common.exceptions import NoSuchElementException, TimeoutException
from selenium.webdriver.common.action_chains import ActionChains
from urllib import parse
import argparse
import time
import logging
import sys
import os
import re
import json
logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.INFO)
logger = logging.getLogger(__name__)
def client_setup(args):
"""Return a dict containing the driver and the extension's id"""
co = webdriver.ChromeOptions()
cap = co.to_capabilities()
cap['loggingPrefs'] = {'driver': 'INFO', 'browser': 'INFO'}
if args.remote:
client = webdriver.Remote(desired_capabilities=cap, command_executor=args.remote)
else:
client = webdriver.Chrome(desired_capabilities=cap)
client.get('https://gnunet.org/')
html = client.find_element(By.TAG_NAME, "html")
return client
parser = argparse.ArgumentParser()
parser.add_argument('--remote', help="Points webdriver.Remote at URI", metavar="URI", type=str, dest="remote")
args = parser.parse_args()
ret = client_setup(args)
logger.info("Chromium is responsive")
time.sleep(3)
ret.close()
|