Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I get the DevToolsSession? #12

Closed
firecrauter opened this issue Sep 20, 2022 · 0 comments
Closed

How do I get the DevToolsSession? #12

firecrauter opened this issue Sep 20, 2022 · 0 comments

Comments

@firecrauter
Copy link

firecrauter commented Sep 20, 2022

like OpenQA.Selenium.Chrome.ChromeDriver https://stackoverflow.com/a/70218124/17287495
selenium/dotnet/src/webdriver/DevTools/IDevTools.cs


or implement GetDevToolsSession() in Sl.Selenium.Extensions.ChromeDriver / sldriver when is SlDriverBrowserType.Chrome.
Right now I can only do it by downloading all 3 projects and changing
(Selenium.Extensions.SLDriver.cs _baseDriver)
WebDriver _baseDriver; to ChromiumDriver _baseDriver;
and adding

  public OpenQA.Selenium.DevTools.DevToolsSession GetDevToolsSession()
         {
             return _baseDriver.GetDevToolsSession();
         }


Something like this, or however you prefer:



    public class TestSlChromeDriver
    {
        public TestSlChromeDriver()
        {
            ChromeDriver.KillAllChromeProcesses();
            Driver = ChromeDriver.Instance();

        }
        public SlDriver Driver { get; private set; }

        public void Start()
        {
            Driver.GoTo("https://google.com");
            try
            {
                //ChromeDriver(SlDriver) no implement IDevTools
                if (Driver is ChromeDriver chromeDriver &&
                    chromeDriver is IDevTools devTools)
                {
                    IDevToolsSession session = devTools.GetDevToolsSession();
                    //....
                }
            }
            catch (Exception ex)
            {

            }
        }
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant