... This is new python project to keep my competence in check. ...
To rename a branch both locally and remotely in Git, you can use the following commands:
git branch -m old_branch new_branch
git push origin :old_branch
git push origin new_branch
git push origin -u new_branch
In this example, old_branch is the name of the branch you want to rename and new_branch is the new name you want to give to the branch
Tags: Selenium, Python
Usage: wait = WebDriverWait(driver, 10) wait.until(EC.element_to_be_clickable(By.XPATH, ))
-- In Windows, we can install it by going to the python installation directory, then type <python.exe -m venv < path-to-install-the-package>
-- In Windows, the file is located inside the directory, while in Mac/Linux, it may be inside the directory
- Create a file name <pytest.ini> or hidden version <.pytest.ini>
-
> [pytest] # This should be the first line
> python_files = test_*
> python_classes = Tests*
> python_functions = test_*
- add more as needed
-
from selenium import webdriver from selenium.webdriver.firefox.service import Service from webdriver-manager import GeckoDriverManager
driver = webdriver.Firefox(service=Service(executable_path=GeckoDriverManager().install())) driver.maximize_window()
driver.get('url.to.test.website')
A concise and comprehensive pytest.ini
file for Selenium tests might include settings for configuring test runs, plugins, and output formats. Here's an example:
[pytest]
# Test discovery
python_files = test_*.py
python_classes = Test*
python_functions = test_*
# Output settings
addopts = -ra -v --html=reports/report.html --self-contained-html
norecursedirs = .git .tox venv
# Plugins
filterwarnings =
ignore::DeprecationWarning
ignore::UserWarning
# HTML report customization
render_collapsed = True
render_module = true
render_class = true
render_instance = true
In this pytest.ini
file:
python_files
,python_classes
, andpython_functions
define patterns to discover test files, classes, and functions, respectively.addopts
specifies additional command-line options for pytest, including generating an HTML report (--html=reports/report.html
) with verbose output (-v
) and showing all test results (-ra
). The--self-contained-html
option ensures that the report is self-contained.norecursedirs
excludes specific directories from test discovery.filterwarnings
suppresses certain types of warnings during test execution.- HTML report customization options (
render_collapsed
,render_module
,render_class
,render_instance
) control the level of detail in the HTML report.
Adjust these settings according to your project's needs.