Search code examples
pythonseleniumselenium-webdriverwebdriver

vendor_prefix selenium webdriver


I want to execute cdp commands using asyncio and like the execute_cdp_cmd command in selenium and i also found the undocumented (maybe i dont have the correct documentation) endpoint url of the chrome webdriver, see here executeCdpCommand.

self._commands['executeCdpCommand'] = ('POST', '/session/$sessionId/{}/cdp/execute'.format(vendor_prefix))

As you can see I need a vendor_prefix to correctly execute the cdp command. The only sentence I found was in the source's docstring of the ChromiumDriver in selenium.

 - vendor_prefix - Company prefix to apply to vendor-specific WebDriver extension commands.

I couldn't find the anything useful on the internet, does anybody know the answer and could give me an example


Solution

  • I found in the java source for selenium the google chrome vendor prefix which is expect by the webdriver it is:

      @Override
      public Map<String, CommandInfo> getAdditionalCommands() {
        return ImmutableMap.of(
          EXECUTE_CDP, new CommandInfo("session/:sessionId/goog/cdp/execute", HttpMethod.POST));
      }