Reputation: 854
I am looking for a way to use web drivers (ChromeDriver, IEDriver, GeckoDriver etc., all together) with my native python app such that, the app will figure out the browser, and choose the driver accordingly, and will do some actions (like click an element or get data). I want to do the task in python without using selenium
Upvotes: 1
Views: 860
Reputation: 27496
It would theoretically be possible to use the driver executables without Selenium. All WebDriver implementations operate using the same mechanism. That mechanism is starting an HTTP server running locally, and listening on a well-known set of end points (URLs) for HTTP requests containing well-defined JSON bodies.
It’s fully possible to even start a WebDriver implementation like IEDriverServer.exe
, geckodriver
, or chromedriver
and automate the browser even using a tool like cURL, so using a Python HTTP client library and JSON parser is certainly in the realm of the possible. However, doing so requires a fairly thorough understanding of the protocol used in communicating with the driver, and gaining that understanding is distinctly non-trivial. In fact, use of that protocol without needing to know the details of it is one of the very reasons for Selenium’s existence.
While what you say you want to do is possible, I would by no means call it recommended. Attempting to go down that road seems like a lot of effort for a very marginal benefit, when you consider you need to worry about lifetime of the executable process you spawn, proper formatting of the HTTP request bodies, and handling all of the potential responses from the remote end. You’d be reinventing a whole lot of things that Selenium already does for you. Your question doesn’t show any indication of why you don’t want to use Selenium, so it’s difficult to provide any further guidance as to alternatives or mitigations to the things you find objectionable about it.
Upvotes: 1