How to use test_browser_name method in Selene

Best Python code snippet using selene_python

conftest.py

Source:conftest.py Github

copy

Full Screen

...7 parser.addoption("--browser", action="store", default="", help="browser")8 parser.addoption("--url", action="store", default="", help="url")9 parser.addoption("--search", action="append", default=[], help="input search")10@pytest.fixture(scope='function')11def test_browser_name(request):12 return request.config.getoption("--browser")13@pytest.fixture(scope='function')14def test_url(request):15 return request.config.getoption("--url")16@pytest.fixture(scope='function')17def test_search(request):18 return request.config.getoption("--search")19@pytest.fixture(scope='function')20def browser(request, test_browser_name):21 browser_name = test_browser_name22 print(browser_name)23 lb = LaunchBrowser()24 request.node.driver = lb.launch_browser(browser_name)25 yield request.node.driver...

Full Screen

Full Screen

test_kill_service_at_exit_chrome.py

Source:test_kill_service_at_exit_chrome.py Github

copy

Full Screen

...4from helium3._impl import is_windows5from tests.api import test_browser_name6from tests.api.test_kill_service_at_exit import KillServiceAtExitAT7from tests.api.util import InSubProcess8@skipIf(test_browser_name() != "chrome", "Only run this test for Chrome")9class KillServiceAtExitChromeTest(KillServiceAtExitAT, TestCase):10 def get_service_process_names(self):11 if is_windows():12 return ["chromedriver.exe"]13 return ["chromedriver"]14 def get_browser_process_name(self):15 return "chrome" + (".exe" if is_windows() else "")16 def start_browser_in_sub_process(self):17 with ChromeInSubProcess():18 pass19class ChromeInSubProcess(InSubProcess):20 @classmethod21 def main(cls):22 start_chrome(headless=True)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Selene automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful