I am creating testing of my website in pytest
using selenium
and selenoid
.
I have a class that inherits from BaseCase and for example when I want to open a webpage I write super().open(URL)
. Or, if I want to click on an element I write: self.click(element_selector)
.
I am a bit confused, however, on why most other examples I find online first have to create a webdriver, and only then can they do actions such as open
and click
, thru it. Whereas I can just access it thru class object (self.click()
).
I understand that this has to do with my using selenoid. However, I am not quite sure how it all fits together.
I have had a lot of trouble finding an explanation online, as every time I try to type in the words selenoid and webdriver together, google assumes I mean selenium. I can't find any related results.
Anyone have an explanation on this? (Or, even a better search term to use than Selenoid Webdriver Pytest or What do I use instead of Webdriver in Selenoid?

- 175
- 2
- 10
1 Answers
I suggest implementing your tests in the way like tutorials suggest, at least until you'll feel experienced. In this way, you will do your tasks in the way most other people do.
So I suggest do not use some libraries classes inheritance, but creating webdriver
instance and using it. (But still, it's your choice and up to you). I cannot add anything more without seeing your code..
Selenium + Selenoid
Selenoid behaves like Selenium Grid.
If your Selenoid started on localhost:4444
, just
from selenium import webdriver
chrome_options = webdriver.ChromeOptions()
driver = webdriver.Remote(
command_executor='http://localhost:4444/wd/hub',
options=chrome_options
)
driver.get("http://www.google.com")
driver.quit()
Setup Selenoid
(assumed you already have Docker):
1 Download cm
from
https://github.com/aerokube/cm/releases
2 Run chmod +x cm
3 Run
./cm selenoid start
And your Selenoid will be ready to accept requests.
Check http://localhost:4444/status
.
References
https://aerokube.com/selenoid/latest/
https://www.selenium.dev/documentation/webdriver/remote_webdriver/

- 2,698
- 2
- 10
- 14
-
Thanks for the explanations on using `selenium`! I'm looking for explanations on how `seleniumbase` works, not ways to get around its features. – user613 Jun 09 '22 at 08:02