Python/selenium: Difference between revisions
< Python
(Die Seite wurde neu angelegt: „== linux == *“) |
(→linux) |
||
Line 1: | Line 1: | ||
== linux == | == linux == | ||
* | * imports | ||
<blockquote> | |||
<pre> | |||
import selenium | |||
from selenium.webdriver.common.by import By | |||
from selenium.webdriver.support import expected_conditions as EC | |||
from selenium.webdriver.support.ui import WebDriverWait | |||
from selenium.webdriver.support.ui import Select | |||
from selenium.webdriver.chrome.options import Options | |||
</pre> | |||
</blockquote> | |||
* initialize | |||
<blockquote> | |||
<pre> | |||
def openbrowser(): | |||
global browser | |||
chrome_options = Options() | |||
chrome_options.add_argument("--force-renderer-accessibility") | |||
browser = selenium.webdriver.PhantomJS() | |||
#browser = selenium.webdriver.Chrome('/usr/local/bin/chromedriver', chrome_options=chrome_options) # linux | |||
browser.set_window_position(1280, 0) | |||
browser.set_window_size(1280, 1400) | |||
</pre> | |||
</blockquote> | |||
* | |||
<blockquote> | |||
<pre> | |||
</pre> | |||
</blockquote> |
Revision as of 17:30, 24 November 2017
linux
- imports
import selenium from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support.ui import Select from selenium.webdriver.chrome.options import Options
- initialize
def openbrowser(): global browser chrome_options = Options() chrome_options.add_argument("--force-renderer-accessibility") browser = selenium.webdriver.PhantomJS() #browser = selenium.webdriver.Chrome('/usr/local/bin/chromedriver', chrome_options=chrome_options) # linux browser.set_window_position(1280, 0) browser.set_window_size(1280, 1400)