-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
test_internet_explorer.py
69 lines (43 loc) · 1.82 KB
/
test_internet_explorer.py
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import os
import subprocess
import sys
import pytest
from selenium import webdriver
@pytest.mark.skipif(sys.platform != "win32", reason="requires Windows")
def test_basic_options_win10(edge_bin):
options = webdriver.IeOptions()
options.attach_to_edge_chrome = True
options.edge_executable_path = edge_bin
driver = webdriver.Ie(options=options)
driver.quit()
@pytest.mark.skipif(sys.platform != "win32", reason="requires Windows")
def test_basic_options_win11():
options = webdriver.IeOptions()
driver = webdriver.Ie(options=options)
driver.quit()
@pytest.mark.skipif(sys.platform != "win32", reason="requires Windows")
def test_log_to_file(log_path):
service = webdriver.IeService(log_output=log_path, log_level='INFO')
driver = webdriver.Ie(service=service)
with open(log_path, 'r') as fp:
assert "Starting WebDriver server" in fp.readline()
driver.quit()
@pytest.mark.skipif(sys.platform != "win32", reason="requires Windows")
def test_log_to_stdout(capfd):
service = webdriver.IeService(log_output=subprocess.STDOUT)
driver = webdriver.Ie(service=service)
out, err = capfd.readouterr()
assert "Started InternetExplorerDriver server" in out
driver.quit()
@pytest.mark.skipif(sys.platform != "win32", reason="requires Windows")
def test_log_level(log_path):
service = webdriver.IeService(log_output=log_path, log_level='WARN')
driver = webdriver.Ie(service=service)
with open(log_path, 'r') as fp:
assert 'Started InternetExplorerDriver server (32-bit)' in fp.readline()
driver.quit()
@pytest.mark.skipif(sys.platform != "win32", reason="requires Windows")
def test_supporting_files(temp_dir):
service = webdriver.IeService(service_args=["–extract-path="+temp_dir])
driver = webdriver.Ie(service=service)
driver.quit()