2

Im using selenium-java 4.6.0 and Im capturing network traffic.When I try to import the selenium class for 'Network', I get several options :

  • org.openqa.selenium.devtools.v107.network.Network;
  • org.openqa.selenium.devtools.v106.network.Network;
  • etc...

Is there a way to select always the last version available? Or another way to not to change with each new release the import version?

xpt
  • 20,363
  • 37
  • 127
  • 216
matias
  • 57
  • 5

2 Answers2

2

I had the exact same question a while back. Here is the answer I got back from Jim Evans (one of the Selenium developers):

those will change with every release. If you choose to use the raw DevTool protocol API, you’re tying yourself to a specific version of Chrome. This is the same reason that CDP-based automation libraries like Puppeteer tie their releases to specific versions of Chrome. Selenium provides version-agnostic APIs for common things that many people want to use CDP for, like network request/response interception and manipulation. If you find those APIs lacking, it would be instructive to know your use case, and how common it is.

source

SiKing
  • 10,003
  • 10
  • 39
  • 90
  • 1
    Yes, I see but the didnt answer which library we need to use, he said "Selenium provides version-agnostic APIs for common things that many people want to use CDP" – matias Nov 14 '22 at 17:37
  • @matias Well, it's all the ones that do not have a `vXX` in the package name. Some [examples are here](https://www.selenium.dev/documentation/webdriver/bidirectional/chrome_devtools/). – SiKing Nov 14 '22 at 18:51
  • aha but I need to specific the version on the import and the options available only have vXX – matias Nov 14 '22 at 19:13
0

Hmm I think you can do this by specifying a specific import in class: import org.openqa.selenium.devtools.v85.network.Network;

With one version import it's no way that it take some other version.