-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpyunitsetup.py
More file actions
42 lines (37 loc) · 1.51 KB
/
Copy pathpyunitsetup.py
File metadata and controls
42 lines (37 loc) · 1.51 KB
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
import os
from os import environ
from selenium import webdriver
from selenium.webdriver.edge.service import Service as EdgeService
from selenium.webdriver.edge.options import Options as EdgeOptions
class PyUnitTestSetup:
def __init__(self):
# Get environment variables
lt_username = environ.get('LT_USERNAME', None)
lt_access_key = environ.get('LT_ACCESS_KEY', None)
# Set LambdaTest options
lt_options = {
'build': 'Best 13 Python Automation Scripts',
'project': 'Project: Best 13 Python Automation Scripts',
'name': 'Test: Best 13 Python AutomationScripts',
'platform': 'Windows 10',
'browserName': 'MicrosoftEdge',
'version': 'latest',
'visual': True, # Enable visual testing
'network': True, # Enable network capture
'console': True, # Enable console logs
'video': True, # Enable video recording
'timezone': 'UTC' # Set timezone
}
# Initialize Edge browser with LambdaTest options
edge_options = EdgeOptions()
edge_options.set_capability('LT:Options', lt_options)
self.driver = webdriver.Remote(
command_executor=f"https://{lt_username}:{lt_access_key}@hub.lambdatest.com/wd/hub",
options=edge_options
)
def setUp(self):
self.driver.implicitly_wait(10)
self.driver.maximize_window()
def tearDown(self):
if self.driver:
self.driver.quit()