Questions tagged [pytest-selenium]
14 questions
5
votes
1 answer
how to pass firefox/chrome headless mode via command line to pytest
I need to run my selenium test cases remotely in headless mode.
Currently, I am running below py.test command
py.test --driver remote --host selenium.host --port 4444 --capability browserName firefox --capability platform LINUX
And for headless…

Anurag Choudhary
- 752
- 1
- 11
- 16
4
votes
3 answers
Testing a Flask app with pytest-flask + pytest-selenium (docker)
I am trying to test a Flask web app within a docker container, which is new for me. My stack is the following:
firefox
selenium
pytest-selenium
pytest-flask
Here is my Flask app file:
from flask import Flask
def create_app():
app =…

erup
- 183
- 3
- 12
2
votes
1 answer
Pytest Selenium elem.send_keys() causing TypeError: object of type 'NoneType' has no len()
I am trying to send data to a login textbox but when I use 'send_keys' I get an error..
def wait_for_element(selenium, selenium_locator, search_pattern, wait_seconds=10):
elem = None
wait = WebDriverWait(selenium, wait_seconds)
try:
…

Austin
- 33
- 6
2
votes
0 answers
pytest command fails after generating project with PyScaffold 3.0
I was following the instructions in the docs, I have this:
import pytest
@pytest.mark.nondestructive
def test_nondestructive(selenium):
selenium.get('http://www.example.com')
when I run this at the command line:
(venv) $ pytest --driver Firefox…

Alexander Mills
- 90,741
- 139
- 482
- 817
1
vote
3 answers
Pytest test discovery in subfolders
Hi I have the following project architecture, I am using selenium with pytest
From the terminal, when I am at the root folder, I can not run one
the tests inside the folder "\tests"
As far as you know Pytest should be able to discover all tests in…
user7238416
1
vote
0 answers
How to run pytest-selenium with xdist and use cli arg driver?
I am trying to run multiple tests in parallel using xdist and determine the webdriver based on the user's command line argument such as
--driver Remote/Chrome/etc
Ultimately, I am trying throw this into docker so that it can be used in a gitlab…

Austin
- 33
- 6
1
vote
2 answers
How to pass arguments to Selenium test functions in Pytest?
I wamt to make my tests more flexible. For example I have a _test_login_ that could be reused with multiple different login credentials. How do I pass them as arguments instead of hard-coding them?
What I have right now:
from selenium import…

CrispJam
- 159
- 1
- 6
- 16
1
vote
2 answers
remote selenium grid over https is not working
The company I work for requires / impresses that all our selenium test traffic be conducted through https when using the remote selenium grid server that we have hosted in AWS inside a docker instance.
Until now this seems to have been working, but…

Roochiedoor
- 887
- 12
- 19
1
vote
2 answers
Storing global configuration data in a pytest/xdist framework
I'm building a test framework using python + pytest + xdist + selenium grid. This framework needs to talk to a pre-existing custom logging system. As part of this logging process, I need to submit API calls to: set up each new test run, set up test…

sprad
- 313
- 3
- 10
1
vote
2 answers
Using pytest-variables in a module outside a function
I am using Pytest and Pytest-variables with parametrized test functions to try and reduce duplication of code across test cases. I have this working with hard-coded strings within the test module: similar to this; however, I have no idea how to…

Muck
- 68
- 1
- 9
0
votes
1 answer
Passing different Xpaths every test session, using same tests with different apps on Android mobile
i have a problem with switching file with xpaths and test data for appPackage that is currently under tests:
tests.py
@pytest.fixture(params=brand_list)
def driver(request):
desired_caps = {
"platformName": "Android",
…

art rtr
- 1
- 1
0
votes
1 answer
pytest-selenium installed but not available as plugin for pytest. What have I done wrong?
I've installed pytest-selenium, but I cannot use it with pytest.
def test_sanity(selenium):
E fixture 'selenium' not found
> available fixtures: cache, capfd, capfdbinary, caplog, capsys, capsysbinary, check, cov, dash_br, dash_duo,…

Daniel Paczuski Bak
- 3,720
- 8
- 32
- 78
0
votes
0 answers
pytest-xdist: How to execute a method (where I initialize DB mocks for all the tests in that file) before the test methods are executed
I have a test suite that used to be executed with pytest and I used the method before_all_tests(request) in each test file to initialize the db mockups for those tests.
I wanted to use pytest-xdist to run them parallelly, but…

Сабрина
- 41
- 3
-1
votes
1 answer
Is there any way to get all the "inner html text" of a website and its corresponding coordinates using python selenium?
I'm able to get the div elements by using this code:
divs = driver.find_elements_by_xpath("//div")
and by looping through the divs and using .text attribute I'm able to get the text as well
code:
for i in divs:
print(i.text)
but in my…

Ashish Johnson
- 379
- 4
- 16