There is a statement from microsoft documentation about Selenium testing in a continuous integration pipeline:
To include the Selenium test as part of a build, the source code must be in version control.
The build summary includes a snapshot of the test results. There is also a Tests results page that highlights the build-on-build changes, including errors, stack traces, and the ability to easily create a bug that contains this information.
Selenium tests use graphical interface, so I do not think that they could be used on build stage, because application is not deployed yet. Am I right?