geckodriver icon indicating copy to clipboard operation
geckodriver copied to clipboard

OpenQA.Selenium.NoSuchWindowException: 'Browsing context has been discarded'

Open ozerkon opened this issue 3 years ago • 23 comments

System

  • Version: 0.33
  • Platform: Windows 11
  • Firefox: 117.0.1 (64 bit)
  • Selenium: 4.13.0

Testcase

Hi. I have an net.core desktop app. The main purpose of this application is to open the message sent by the administrator and click on the "Okudum" (it means 'i read') button on the opened iframe. After the click the next unread message appears automatically and the method wants to test that the iframe is loaded.

error2 fw

At this point geckodriver throws an exception: OpenQA.Selenium.NoSuchWindowException: 'Browsing context has been discarded' error fw

It works flawlessly with Chromedriver. In fact, I was using the application very often about 4 months ago and it was working smoothly with geckodriver. I needed the application again and frankly I would like it to work properly with firefox as well.

Here is the complete method:

        public bool ConfirmMessages(out string msg) {
          lblReport.Text += "* mebbis.meb.gov.tr sayfası açıldı.\r\n";
          msg = "";
          WinHelpers.WaitForPageLoad(out Common.msg);
          if (Common.driver.PageSource.Contains("Doğrulaması Aktif")) {
            Common.mebAjandaActive = true;
            fLogin f = new fLogin(true);
            while (Common.driver.PageSource.Contains("Doğrulaması Aktif") || Common.driver.PageSource.Contains("Doğrulama Gerçekleşmedi")) {
              if (f.ShowDialog() == DialogResult.OK) {
                Common.mebAjandaText = WinHelpers.GetElementBy("i", "txtDogrulamaKodu", out Common.msg);
                Common.mebAjandaButton = WinHelpers.GetElementBy("i", "btnDogrula", out Common.msg);
                if (Common.mebAjandaText != null && Common.mebAjandaButton != null) {
                  Common.mebAjandaText.Clear();
                  Common.mebAjandaText.SendKeys(Common.captcha);
                  Common.mebAjandaButton.Click();
                }
              } else {
                lblMessage.Text = "İşlem iptal edildi";
                Common.driver.Dispose();
                return false;
              }
            }
          }

          IWebElement ? dysFlipMenu = GetDysLink();
          if (dysFlipMenu == null) {
            lblMessage.Text = "DYS giriş linki bulunamadı\r\nLütfen daha sonra tekrar deneyin";
            Common.driver.Dispose();
            return false;
          }
          Actions action = new Actions(Common.driver);
          action.MoveToElement(dysFlipMenu).Perform();

          int tryCount = 0;
          Thread.Sleep(1000);
          if (Common.bgwConfirm.CancellationPending) {
            return false;
          }
          IWebElement ? dysgiris = GetLoginLink();
          if (dysgiris == null) {
            lblMessage.Text = "DYS giriş linki bulunamadı\r\nLütfen daha sonra tekrar deneyin";
            Common.driver.Dispose();
            return false;
          }
          dysgiris.Click();

          if (Common.driver.WindowHandles.Count > 1) {
            Common.driver.SwitchTo().Window(Common.driver.WindowHandles[1]);
            WinHelpers.WaitForPageLoad(out Common.msg);
            if (Common.bgwConfirm.CancellationPending) {
              return false;
            }
          }
          tryCount = 0;
          lblReport.Text += "* dysweb.meb.gov.tr sekmesine geçildi.\r\n";
          List < IWebElement > ? tree = null;

          while (tree == null) {
            Thread.Sleep(100);
            tree = Common.driver.FindElements(By.CssSelector("li[id^='menuForm:roller_tree:']")).ToList();
            tryCount++;
            if (tryCount == 300) {
              lblMessage.Text = "Sayfa 30 saniye boyunca yanıt vermediği için işlem iptal edildi";
              Common.driver.Dispose();
              return false;
            }
            if (Common.bgwConfirm.CancellationPending) {
              return false;
            }
          }

          if (tree.Count > 9) {
            Common.isManager = true;
            Common.mdLink = GetMdLink();
            if (Common.mdLink == null) {
              lblMessage.Text = "İdareci mesajları listelenemdi\r\nLütfen daha sonra tekrar deneyin";
              Common.driver.Dispose();
              return false;
            }
            Common.mdLink.Click();
            if (Common.bgwConfirm.CancellationPending) {
              return false;
            }
          }

          while (!Common.driver.PageSource.Contains("listelenmektedir")) {
            Thread.Sleep(100);
            if (Common.driver.PageSource.Contains("evrak bulunmamaktadır")) {
              lblReport.Text += "* Onaylanmamış mesaj yok.\r\n";
              lblMessage.Text = "Onaylanmamış mesaj yok";
              return false;
            }
            tryCount++;
            if (tryCount == 300) {
              lblReport.Text += "* Sayfa 30 saniye boyunca yanıt vermediği için işlem iptal edildi.\r\n";
              lblMessage.Text = "Sayfa 30 saniye boyunca yanıt vermediği için işlem iptal edildi";
              Common.driver.Dispose();
              return false;
            }
            if (Common.bgwConfirm.CancellationPending) {
              return false;
            }
          }
          IWebElement isler = WinHelpers.GetElementBy("i", "form:etiketFilter", out Common.msg);

          string sayi = isler.Text.Substring(23, isler.Text.Substring(23).IndexOf(" "));

          try {
            Common.totalMessages = Convert.ToInt32(sayi);
            pbProcess.Maximum = Common.totalMessages;
            lblReport.Text += $ "* {Common.totalMessages} adet okunmamış mesaj bulundu.\r\n";
            Common.ilksatir = WinHelpers.GetButtonElementBy("x", "/html/body/div[2]/div[4]/form/div[1]/div/div/div[2]/div/div[2]/table/tbody/tr[1]/td[6]", out Common.msg);
            Common.ilksatir?.Click();
            while (!Common.driver.PageSource.Contains("Gelen Evrak Gözden Geçirme") && !Common.driver.PageSource.Contains("Evrak Görüntüleme")) {
              Thread.Sleep(1000);
              if (Common.bgwConfirm.CancellationPending) {
                return false;
              }
            }

            lblReport.Text += "* Onaylama işlemi başlatılıyor...\r\n";

            for (int i = 0; i < Common.totalMessages; i++) {
              while (!Common.driver.PageSource.Contains("Gelen Evrak Gözden Geçirme") && !Common.driver.PageSource.Contains("Evrak Görüntüleme")) {
                Thread.Sleep(100);
                if (Common.bgwConfirm.CancellationPending) {
                  return false;
                }
              }

              IList < IWebElement > hiddenElements = Common.driver.FindElements(By.CssSelector("ui-dialog"));
              foreach(IWebElement item in hiddenElements) {
                Common.wait?.Until(e => ((IJavaScriptExecutor) Common.driver).ExecuteScript("arguments[0].setAttribute('style', 'display:none')", item));
                if (Common.bgwConfirm.CancellationPending) {
                  return false;
                }
              }

              IWebElement ? iframe = null;
              while (iframe == null) {
                iframe = WinHelpers.GetElementBy("i", "gozdenGecirmeEkraniId", out Common.msg);
                Thread.Sleep(500);
                if (Common.bgwConfirm.CancellationPending) {
                  return false;
                }
                if (Screen.PrimaryScreen?.Bounds.Height < 1080) WinHelpers.ZoomOut();
              }
              Common.driver.SwitchTo().Frame("gozdenGecirmeEkraniId");

              IWebElement ? okudum = null;
              if (Common.driver.PageSource.Contains("Okudum")) {
                okudum = WinHelpers.GetButtonElementBy("x", "//*[@id=\"formspanel:okudumBtn\"]", out Common.msg);
              }
              if (okudum != null) {
                okudum.Click();
                Common.confirmedMessages++;
                pbProcess.Value = Common.confirmedMessages;
                if (Common.bgwConfirm.CancellationPending) {
                  return false;
                }
              } else {
                IWebElement ? kapat = WinHelpers.GetButtonElementBy("x", "//*[@id=\"formspanel:_08001kapat2\"]", out Common.msg);
                if (kapat != null) {
                  kapat.Click();
                  Common.nonConfirmedMessages++;
                  if (Common.bgwConfirm.CancellationPending) {
                    return false;
                  }
                }
                continue;
              }
              while (!Common.driver.PageSource.Contains("Gelen Evrak Gözden Geçirme")) { // throws an error here
                Thread.Sleep(1000);
                if (Common.bgwConfirm.CancellationPending) {
                  return false;
                }
              }
            }
            return true;
          } catch (Exception ex) {
            Common.confirmError = true;
            msg = ex.Message;
            return false;
          }
        }

ozerkon avatar Sep 25 '23 21:09 ozerkon

@ozerkon when you mark the message as read, is the current iframe maybe removed, and a new one created for the new message? If yes, you would have to switch to the parent frame first and then find and select the new iframe. A trace log would be kinda helpful here. Maybe you can attach one (please not paste directly in here)?

whimboo avatar Sep 28 '23 14:09 whimboo

First of all, I apologize for being late in responding. As for the answer to your question; No, the iframe does not disappear when a message is marked as read. As I said before, "the system works fine with Google Chrome".

ozerkon avatar Oct 16 '23 18:10 ozerkon

Ok, so given the lack of running this testcase maybe you can provide a trace log as requested in my last comment? Thanks.

whimboo avatar Oct 16 '23 18:10 whimboo

firefoxOptions.LogLevel = FirefoxDriverLogLevel.Trace; string logPath = Path.Combine(Application.StartupPath, "geckodriver.log"); firefoxOptions.AddArgument($"-moz-log={logPath}");

Did I make a mistake somewhere? The "geckodriver.log" file is not created.

Frankly, I don't know where else I can get the "trace log" output. I couldn't find any results from my searches on the internet.

ozerkon avatar Oct 16 '23 20:10 ozerkon

Which Selenium binding is that? Geckodriver always logs to stdout so it would be a Selenium question then. In case of our documentation is outdated we should update it once the solution has been found.

whimboo avatar Oct 17 '23 07:10 whimboo

Selenium.WebDriver 4.13.0

ozerkon avatar Oct 17 '23 09:10 ozerkon

This is only the version but not the binding (language).

whimboo avatar Oct 17 '23 09:10 whimboo

I did not understand your question. When you say language, do you mean programming language? (I write in C#)

ozerkon avatar Oct 17 '23 10:10 ozerkon

Yes, that is what a binding is for Selenium. Thanks. So does it mean the following lines do not work?

whimboo avatar Oct 17 '23 10:10 whimboo

Yes, unfortunately it doesn't work.

ozerkon avatar Oct 17 '23 15:10 ozerkon

Hm, then I don't know how to activate the trace logs in C#. @titusfortner do you know?

whimboo avatar Oct 24 '23 19:10 whimboo

@ozerkon until we know how to create a trace log would you mind in which line of the test the failure actually happens? Maybe we could iterate forward and find the solution.

whimboo avatar Nov 14 '23 17:11 whimboo

No further reply from reporter. Closing as incomplete.

whimboo avatar Jan 04 '24 08:01 whimboo

Hm, then I don't know how to activate the trace logs in C#. @titusfortner do you know?

Sorry, I missed this. We just added support in 4.16, but we don't have the examples in our docs, yet

titusfortner avatar Jan 04 '24 15:01 titusfortner

@titusfortner what has been changed to what we have listed at: https://firefox-source-docs.mozilla.org/testing/geckodriver/TraceLogs.html#c-sharp?

whimboo avatar Jan 04 '24 16:01 whimboo

How didn't that work?

        [TestMethod]
        public void FirefoxLogging()
        {
            var options = new FirefoxOptions();
            options.LogLevel = FirefoxDriverLogLevel.Trace;
            driver = new FirefoxDriver(options);
            driver.Url = "https://www.selenium.dev";
        }

Run with this command:

dotnet test --filter FirefoxLogging     

This goes to console:

  Determining projects to restore...
  All projects are up-to-date for restore.
  SeleniumDocs -> /Users/titusfortner/code/seleniumhq.github.io/examples/dotnet/SeleniumDocs/bin/Debug/net6.0/SeleniumDocs.dll
Test run for /Users/titusfortner/code/seleniumhq.github.io/examples/dotnet/SeleniumDocs/bin/Debug/net6.0/SeleniumDocs.dll (.NETCoreApp,Version=v6.0)
Microsoft (R) Test Execution Command Line Tool Version 17.3.3 (x64)
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
1706650623605   geckodriver     INFO    Listening on 127.0.0.1:59837
1706650623674   mozrunner::runner       INFO    Running command: MOZ_CRASHREPORTER="1" MOZ_CRASHREPORTER_NO_REPORT="1" MOZ_CRASHREPORTER_SHUTDOWN="1" MOZ_NO_REMOTE="1" "/App ... "--marionette" "-foreground" "-no-remote" "-profile" "/var/folders/rh/25cw4qq10_157fjpztk0psx80000gn/T/rust_mozprofileyL6UTy"
1706650623675   geckodriver::marionette DEBUG   Waiting 60s to connect to browser on 127.0.0.1
1706650623675   geckodriver::browser    TRACE   Failed to open /var/folders/rh/25cw4qq10_157fjpztk0psx80000gn/T/rust_mozprofileyL6UTy/MarionetteActivePort
1706650623675   geckodriver::marionette TRACE   Retrying in 100ms
1706650623779   geckodriver::browser    TRACE   Failed to open /var/folders/rh/25cw4qq10_157fjpztk0psx80000gn/T/rust_mozprofileyL6UTy/MarionetteActivePort
1706650623779   geckodriver::marionette TRACE   Retrying in 100ms
1706650623880   geckodriver::browser    TRACE   Failed to open /var/folders/rh/25cw4qq10_157fjpztk0psx80000gn/T/rust_mozprofileyL6UTy/MarionetteActivePort
1706650623880   geckodriver::marionette TRACE   Retrying in 100ms
1706650623984   geckodriver::browser    TRACE   Failed to open /var/folders/rh/25cw4qq10_157fjpztk0psx80000gn/T/rust_mozprofileyL6UTy/MarionetteActivePort
1706650623984   geckodriver::marionette TRACE   Retrying in 100ms
console.warn: services.settings: Ignoring preference override of remote settings server
console.warn: services.settings: Allow by setting MOZ_REMOTE_SETTINGS_DEVTOOLS=1 in the environment
1706650624088   geckodriver::browser    TRACE   Failed to open /var/folders/rh/25cw4qq10_157fjpztk0psx80000gn/T/rust_mozprofileyL6UTy/MarionetteActivePort
1706650624088   geckodriver::marionette TRACE   Retrying in 100ms
1706650624192   geckodriver::browser    TRACE   Failed to open /var/folders/rh/25cw4qq10_157fjpztk0psx80000gn/T/rust_mozprofileyL6UTy/MarionetteActivePort
1706650624192   geckodriver::marionette TRACE   Retrying in 100ms
1706650624295   geckodriver::browser    TRACE   Failed to open /var/folders/rh/25cw4qq10_157fjpztk0psx80000gn/T/rust_mozprofileyL6UTy/MarionetteActivePort
1706650624295   geckodriver::marionette TRACE   Retrying in 100ms
1706650624370   Marionette      INFO    Marionette enabled
1706650624373   RemoteAgent     DEBUG   Setting recommended pref apz.content_response_timeout to 60000
1706650624373   RemoteAgent     DEBUG   Setting recommended pref browser.contentblocking.introCount to 99
1706650624373   RemoteAgent     DEBUG   Setting recommended pref browser.download.panel.shown to true
1706650624373   RemoteAgent     DEBUG   Setting recommended pref browser.newtabpage.activity-stream.showSponsoredTopSites to false
1706650624373   RemoteAgent     DEBUG   Setting recommended pref browser.newtabpage.enabled to false
1706650624373   RemoteAgent     DEBUG   Setting recommended pref browser.pagethumbnails.capturing_disabled to true
1706650624374   RemoteAgent     DEBUG   Setting recommended pref browser.region.network.url to 
1706650624374   RemoteAgent     DEBUG   Setting recommended pref browser.safebrowsing.blockedURIs.enabled to false
1706650624374   RemoteAgent     DEBUG   Setting recommended pref browser.safebrowsing.downloads.enabled to false
1706650624374   RemoteAgent     DEBUG   Setting recommended pref browser.safebrowsing.malware.enabled to false
1706650624374   RemoteAgent     DEBUG   Setting recommended pref browser.safebrowsing.phishing.enabled to false
1706650624374   RemoteAgent     DEBUG   Setting recommended pref browser.search.update to false
1706650624374   RemoteAgent     DEBUG   Setting recommended pref browser.startup.couldRestoreSession.count to -1
1706650624374   RemoteAgent     DEBUG   Setting recommended pref browser.tabs.closeWindowWithLastTab to false
1706650624374   RemoteAgent     DEBUG   Setting recommended pref browser.tabs.unloadOnLowMemory to false
1706650624374   RemoteAgent     DEBUG   Setting recommended pref browser.tabs.warnOnClose to false
1706650624374   RemoteAgent     DEBUG   Setting recommended pref browser.tabs.warnOnCloseOtherTabs to false
1706650624374   RemoteAgent     DEBUG   Setting recommended pref browser.tabs.warnOnOpen to false
1706650624374   RemoteAgent     DEBUG   Setting recommended pref browser.toolbars.bookmarks.visibility to never
1706650624374   RemoteAgent     DEBUG   Setting recommended pref browser.topsites.contile.enabled to false
1706650624374   RemoteAgent     DEBUG   Setting recommended pref browser.usedOnWindows10.introURL to 
1706650624374   RemoteAgent     DEBUG   Setting recommended pref browser.urlbar.merino.endpointURL to 
1706650624374   RemoteAgent     DEBUG   Setting recommended pref browser.urlbar.suggest.searches to false
1706650624374   RemoteAgent     DEBUG   Setting recommended pref datareporting.policy.dataSubmissionPolicyAccepted to false
1706650624374   RemoteAgent     DEBUG   Setting recommended pref dom.disable_open_during_load to false
1706650624374   RemoteAgent     DEBUG   Setting recommended pref dom.file.createInChild to true
1706650624374   RemoteAgent     DEBUG   Setting recommended pref dom.input_events.security.minNumTicks to 0
1706650624375   RemoteAgent     DEBUG   Setting recommended pref dom.input_events.security.minTimeElapsedInMS to 0
1706650624375   RemoteAgent     DEBUG   Setting recommended pref dom.max_chrome_script_run_time to 0
1706650624375   RemoteAgent     DEBUG   Setting recommended pref dom.max_script_run_time to 0
1706650624375   RemoteAgent     DEBUG   Setting recommended pref dom.navigation.locationChangeRateLimit.count to 0
1706650624375   RemoteAgent     DEBUG   Setting recommended pref dom.push.connection.enabled to false
1706650624375   RemoteAgent     DEBUG   Setting recommended pref dom.screenorientation.allow-lock to true
1706650624375   RemoteAgent     DEBUG   Setting recommended pref dom.successive_dialog_time_limit to 0
1706650624375   RemoteAgent     DEBUG   Setting recommended pref extensions.getAddons.cache.enabled to false
1706650624375   RemoteAgent     DEBUG   Setting recommended pref extensions.getAddons.discovery.api_url to data:, 
1706650624375   RemoteAgent     DEBUG   Setting recommended pref extensions.blocklist.detailsURL to http://%(server)s/extensions-dummy/blocklistDetailsURL
1706650624375   RemoteAgent     DEBUG   Setting recommended pref extensions.blocklist.itemURL to http://%(server)s/extensions-dummy/blocklistItemURL
1706650624375   RemoteAgent     DEBUG   Setting recommended pref extensions.hotfix.url to http://%(server)s/extensions-dummy/hotfixURL
1706650624375   RemoteAgent     DEBUG   Setting recommended pref extensions.systemAddon.update.url to http://%(server)s/dummy-system-addons.xml
1706650624376   RemoteAgent     DEBUG   Setting recommended pref extensions.update.background.url to http://%(server)s/extensions-dummy/updateBackgroundURL
1706650624376   RemoteAgent     DEBUG   Setting recommended pref extensions.update.url to http://%(server)s/extensions-dummy/updateURL
1706650624376   RemoteAgent     DEBUG   Setting recommended pref extensions.getAddons.get.url to http://%(server)s/extensions-dummy/repositoryGetURL
1706650624376   RemoteAgent     DEBUG   Setting recommended pref extensions.getAddons.search.browseURL to http://%(server)s/extensions-dummy/repositoryBrowseURL
1706650624376   RemoteAgent     DEBUG   Setting recommended pref geo.provider.network.url to 
1706650624376   RemoteAgent     DEBUG   Setting recommended pref identity.fxaccounts.auth.uri to https://{server}/dummy/fxa
1706650624376   RemoteAgent     DEBUG   Setting recommended pref network.connectivity-service.enabled to false
1706650624376   RemoteAgent     DEBUG   Setting recommended pref network.http.phishy-userpass-length to 255
1706650624379   RemoteAgent     DEBUG   Setting recommended pref network.http.prompt-temp-redirect to false
1706650624379   RemoteAgent     DEBUG   Setting recommended pref privacy.trackingprotection.enabled to false
1706650624379   RemoteAgent     DEBUG   Setting recommended pref security.fileuri.strict_origin_policy to false
1706650624379   RemoteAgent     DEBUG   Setting recommended pref security.notification_enable_delay to 0
1706650624379   RemoteAgent     DEBUG   Setting recommended pref security.remote_settings.intermediates.enabled to false
1706650624379   RemoteAgent     DEBUG   Setting recommended pref signon.autofillForms to false
1706650624379   RemoteAgent     DEBUG   Setting recommended pref signon.rememberSignons to false
1706650624379   RemoteAgent     DEBUG   Setting recommended pref toolkit.telemetry.server to https://%(server)s/telemetry-dummy/
1706650624379   RemoteAgent     DEBUG   Setting recommended pref widget.windows.window_occlusion_tracking.enabled to false
1706650624379   RemoteAgent     DEBUG   Setting recommended pref dom.disable_beforeunload to true
1706650624400   geckodriver::browser    TRACE   Failed to open /var/folders/rh/25cw4qq10_157fjpztk0psx80000gn/T/rust_mozprofileyL6UTy/MarionetteActivePort
1706650624401   geckodriver::marionette TRACE   Retrying in 100ms
1706650624504   geckodriver::browser    TRACE   Failed to open /var/folders/rh/25cw4qq10_157fjpztk0psx80000gn/T/rust_mozprofileyL6UTy/MarionetteActivePort
1706650624504   geckodriver::marionette TRACE   Retrying in 100ms
1706650624605   geckodriver::browser    TRACE   Failed to open /var/folders/rh/25cw4qq10_157fjpztk0psx80000gn/T/rust_mozprofileyL6UTy/MarionetteActivePort
1706650624605   geckodriver::marionette TRACE   Retrying in 100ms
1706650624706   geckodriver::browser    TRACE   Failed to open /var/folders/rh/25cw4qq10_157fjpztk0psx80000gn/T/rust_mozprofileyL6UTy/MarionetteActivePort
1706650624706   geckodriver::marionette TRACE   Retrying in 100ms
1706650624809   geckodriver::browser    TRACE   Failed to open /var/folders/rh/25cw4qq10_157fjpztk0psx80000gn/T/rust_mozprofileyL6UTy/MarionetteActivePort
1706650624809   geckodriver::marionette TRACE   Retrying in 100ms
1706650624912   geckodriver::browser    TRACE   Failed to open /var/folders/rh/25cw4qq10_157fjpztk0psx80000gn/T/rust_mozprofileyL6UTy/MarionetteActivePort
1706650624912   geckodriver::marionette TRACE   Retrying in 100ms
1706650625017   geckodriver::browser    TRACE   Failed to open /var/folders/rh/25cw4qq10_157fjpztk0psx80000gn/T/rust_mozprofileyL6UTy/MarionetteActivePort
1706650625017   geckodriver::marionette TRACE   Retrying in 100ms
1706650625121   geckodriver::browser    TRACE   Failed to open /var/folders/rh/25cw4qq10_157fjpztk0psx80000gn/T/rust_mozprofileyL6UTy/MarionetteActivePort
1706650625121   geckodriver::marionette TRACE   Retrying in 100ms
1706650625207   Marionette      TRACE   Received observer notification final-ui-startup
1706650625221   geckodriver::browser    TRACE   Failed to open /var/folders/rh/25cw4qq10_157fjpztk0psx80000gn/T/rust_mozprofileyL6UTy/MarionetteActivePort
1706650625221   geckodriver::marionette TRACE   Retrying in 100ms
1706650625322   geckodriver::browser    TRACE   Failed to open /var/folders/rh/25cw4qq10_157fjpztk0psx80000gn/T/rust_mozprofileyL6UTy/MarionetteActivePort
1706650625322   geckodriver::marionette TRACE   Retrying in 100ms
1706650625335   Marionette      INFO    Listening on port 59846
1706650625340   Marionette      DEBUG   Marionette is listening
Read port: 59846
1706650625755   Marionette      DEBUG   Accepted connection 0 from 127.0.0.1:59847
1706650625909   geckodriver::marionette DEBUG   Connection to Marionette established on 127.0.0.1:59846.
1706650625939   Marionette      DEBUG   0 -> [0,1,"WebDriver:NewSession",{"browserName":"firefox"}]
1706650625943   Marionette      DEBUG   Waiting for initial application window
1706650627828   Marionette      TRACE   Received observer notification browser-idle-startup-tasks-finished
1706650627836   RemoteAgent     TRACE   [9] ProgressListener Start: expectNavigation=false resolveWhenStarted=false unloadTimeout=5000 waitForExplicitStart=false
1706650627836   RemoteAgent     TRACE   [9] ProgressListener Setting unload timer (5000ms)
1706650627836   RemoteAgent     TRACE   [9] Document already finished loading: about:blank
1706650627836   RemoteAgent     TRACE   [9] ProgressListener Stop: has error=false
1706650627848   Marionette      DEBUG   0 <- [1,1,null,{"sessionId":"8c26c746-c19e-4794-8d43-8d3e0a500f5c","capabilities":{"browserName":"firefox","browserVersion":"121.0.1","platformName":"mac","acceptInsecureCerts":false,"pageLoadStrategy":"normal","setWindowRect":true,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"strictFileInteractability":false,"unhandledPromptBehavior":"dismiss and notify","moz:accessibilityChecks":false,"moz:buildID":"20240108143603","moz:headless":false,"moz:platformVersion":"22.5.0","moz:processID":2499,"moz:profile":"/var/folders/rh/25cw4qq10_157fjpztk0psx80000gn/T/rust_mozprofileyL6UTy","moz:shutdownTimeout":60000,"moz:webdriverClick":true,"moz:windowless":false,"proxy":{}}}]
1706650627852   webdriver::server       DEBUG   <- 200 OK {"value":{"sessionId":"8c26c746-c19e-4794-8d43-8d3e0a500f5c","capabilities":{"acceptInsecureCerts":false,"browserNa ... ctability":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"unhandledPromptBehavior":"dismiss and notify"}}}
1706650627862   webdriver::server       DEBUG   -> POST /session/8c26c746-c19e-4794-8d43-8d3e0a500f5c/url {"url":"https://www.selenium.dev"}
1706650627862   Marionette      DEBUG   0 -> [0,2,"WebDriver:Navigate",{"url":"https://www.selenium.dev"}]
1706650627866   Marionette      TRACE   [9] Received event beforeunload for about:blank
1706650627959   Marionette      TRACE   Remoteness change detected. Set new top-level browsing context to 11
1706650627968   Marionette      TRACE   [11] Received event beforeunload for about:blank
1706650627973   Marionette      TRACE   [11] Received event pagehide for about:blank
1706650628537   Marionette      TRACE   [11] Received event DOMContentLoaded for https://www.selenium.dev/
1706650628773   Marionette      TRACE   [11] Received event pageshow for https://www.selenium.dev/
1706650628774   Marionette      DEBUG   0 <- [1,2,null,{"value":null}]
1706650628774   webdriver::server       DEBUG   <- 200 OK {"value":null}
1706650628777   webdriver::server       DEBUG   -> DELETE /session/8c26c746-c19e-4794-8d43-8d3e0a500f5c 
1706650628779   Marionette      DEBUG   0 -> [0,3,"Marionette:Quit",{"flags":["eForceQuit"]}]
1706650628779   Marionette      INFO    Stopped listening on port 59846
1706650629180   Marionette      TRACE   Received observer notification quit-application
1706650629183   Marionette      TRACE   Received observer notification quit-application
1706650629183   RemoteAgent     DEBUG   Resetting recommended pref apz.content_response_timeout
1706650629183   RemoteAgent     DEBUG   Resetting recommended pref browser.contentblocking.introCount
1706650629183   RemoteAgent     DEBUG   Resetting recommended pref browser.download.panel.shown
1706650629183   RemoteAgent     DEBUG   Resetting recommended pref browser.newtabpage.activity-stream.showSponsoredTopSites
1706650629185   RemoteAgent     DEBUG   Resetting recommended pref browser.newtabpage.enabled
1706650629185   RemoteAgent     DEBUG   Resetting recommended pref browser.pagethumbnails.capturing_disabled
1706650629185   RemoteAgent     DEBUG   Resetting recommended pref browser.region.network.url
1706650629185   RemoteAgent     DEBUG   Resetting recommended pref browser.safebrowsing.blockedURIs.enabled
1706650629187   RemoteAgent     DEBUG   Resetting recommended pref browser.safebrowsing.downloads.enabled
1706650629189   RemoteAgent     DEBUG   Resetting recommended pref browser.safebrowsing.malware.enabled
1706650629192   RemoteAgent     DEBUG   Resetting recommended pref browser.safebrowsing.phishing.enabled
1706650629194   RemoteAgent     DEBUG   Resetting recommended pref browser.search.update
1706650629194   RemoteAgent     DEBUG   Resetting recommended pref browser.startup.couldRestoreSession.count
1706650629194   RemoteAgent     DEBUG   Resetting recommended pref browser.tabs.closeWindowWithLastTab
1706650629194   RemoteAgent     DEBUG   Resetting recommended pref browser.tabs.unloadOnLowMemory
1706650629194   RemoteAgent     DEBUG   Resetting recommended pref browser.tabs.warnOnClose
1706650629194   RemoteAgent     DEBUG   Resetting recommended pref browser.tabs.warnOnCloseOtherTabs
1706650629195   RemoteAgent     DEBUG   Resetting recommended pref browser.tabs.warnOnOpen
1706650629195   RemoteAgent     DEBUG   Resetting recommended pref browser.toolbars.bookmarks.visibility
1706650629195   RemoteAgent     DEBUG   Resetting recommended pref browser.topsites.contile.enabled
1706650629195   RemoteAgent     DEBUG   Resetting recommended pref browser.usedOnWindows10.introURL
1706650629195   RemoteAgent     DEBUG   Resetting recommended pref browser.urlbar.merino.endpointURL
1706650629196   RemoteAgent     DEBUG   Resetting recommended pref browser.urlbar.suggest.searches
1706650629197   RemoteAgent     DEBUG   Resetting recommended pref datareporting.policy.dataSubmissionPolicyAccepted
1706650629197   RemoteAgent     DEBUG   Resetting recommended pref dom.disable_open_during_load
1706650629197   RemoteAgent     DEBUG   Resetting recommended pref dom.file.createInChild
1706650629197   RemoteAgent     DEBUG   Resetting recommended pref dom.input_events.security.minNumTicks
1706650629197   RemoteAgent     DEBUG   Resetting recommended pref dom.input_events.security.minTimeElapsedInMS
1706650629197   RemoteAgent     DEBUG   Resetting recommended pref dom.max_chrome_script_run_time
1706650629197   RemoteAgent     DEBUG   Resetting recommended pref dom.max_script_run_time
1706650629198   RemoteAgent     DEBUG   Resetting recommended pref dom.navigation.locationChangeRateLimit.count
1706650629198   RemoteAgent     DEBUG   Resetting recommended pref dom.push.connection.enabled
1706650629198   RemoteAgent     DEBUG   Resetting recommended pref dom.screenorientation.allow-lock
1706650629198   RemoteAgent     DEBUG   Resetting recommended pref dom.successive_dialog_time_limit
1706650629198   RemoteAgent     DEBUG   Resetting recommended pref extensions.getAddons.cache.enabled
1706650629198   RemoteAgent     DEBUG   Resetting recommended pref extensions.getAddons.discovery.api_url
1706650629198   RemoteAgent     DEBUG   Resetting recommended pref extensions.blocklist.detailsURL
1706650629198   RemoteAgent     DEBUG   Resetting recommended pref extensions.blocklist.itemURL
1706650629198   RemoteAgent     DEBUG   Resetting recommended pref extensions.hotfix.url
1706650629198   RemoteAgent     DEBUG   Resetting recommended pref extensions.systemAddon.update.url
1706650629198   RemoteAgent     DEBUG   Resetting recommended pref extensions.update.background.url
1706650629199   RemoteAgent     DEBUG   Resetting recommended pref extensions.update.url
1706650629199   RemoteAgent     DEBUG   Resetting recommended pref extensions.getAddons.get.url
1706650629199   RemoteAgent     DEBUG   Resetting recommended pref extensions.getAddons.search.browseURL
1706650629199   RemoteAgent     DEBUG   Resetting recommended pref geo.provider.network.url
1706650629199   RemoteAgent     DEBUG   Resetting recommended pref identity.fxaccounts.auth.uri
1706650629200   RemoteAgent     DEBUG   Resetting recommended pref network.connectivity-service.enabled
1706650629200   RemoteAgent     DEBUG   Resetting recommended pref network.http.phishy-userpass-length
1706650629200   RemoteAgent     DEBUG   Resetting recommended pref network.http.prompt-temp-redirect
1706650629201   RemoteAgent     DEBUG   Resetting recommended pref privacy.trackingprotection.enabled
1706650629201   RemoteAgent     DEBUG   Resetting recommended pref security.fileuri.strict_origin_policy
1706650629201   RemoteAgent     DEBUG   Resetting recommended pref security.notification_enable_delay
1706650629201   RemoteAgent     DEBUG   Resetting recommended pref security.remote_settings.intermediates.enabled
1706650629201   RemoteAgent     DEBUG   Resetting recommended pref signon.autofillForms
1706650629202   RemoteAgent     DEBUG   Resetting recommended pref signon.rememberSignons
1706650629202   RemoteAgent     DEBUG   Resetting recommended pref toolkit.telemetry.server
1706650629202   RemoteAgent     DEBUG   Resetting recommended pref widget.windows.window_occlusion_tracking.enabled
1706650629202   RemoteAgent     DEBUG   Resetting recommended pref dom.disable_beforeunload
1706650629203   Marionette      DEBUG   Marionette stopped listening
1706650629203   Marionette      DEBUG   0 <- [1,3,null,{"cause":"shutdown","forced":false,"in_app":true}]
1706650629434   webdriver::server       DEBUG   Teardown session
1706650629494   Marionette      DEBUG   Closed connection 0
1706650629845   geckodriver::browser    DEBUG   Browser process stopped: exit status: 0
1706650629889   webdriver::server       DEBUG   <- 200 OK {"value":null}

titusfortner avatar Jan 30 '24 21:01 titusfortner

Thanks @titusfortner! @ozerkon would you mind checking if that solution works for you?

whimboo avatar Jan 31 '24 08:01 whimboo

Selenium is working on improving how this logging can be done in the dotnet service class, but it isn't an issue with Firefox explicitly.

titusfortner avatar Jan 31 '24 13:01 titusfortner

Thanks @titusfortner! @ozerkon would you mind checking if that solution works for you?

First of all, I apologize for the late reply. Here is the test result:

Determining projects to restore...
All projects are up-to-date for restore.
TestProject -> C:\Users\ozerk\iCloudDrive\PROJECTS\DYS\TestProject\bin\Debug\net8.0\TestProject.dll
Test run for C:\Users\ozerk\iCloudDrive\PROJECTS\DYS\TestProject\bin\Debug\net8.0\TestProject.dll (.NETCoreApp,Version=v8.0)
Microsoft (R) Test Execution Command Line Tool Version 17.8.0 (x64)
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.

Passed!  - Failed:     0, Passed:     1, Skipped:     0, Total:     1, Duration: 8 s - TestProject.dll (net8.0)
PS C:\Users\ozerk\iCloudDrive\PROJECTS\DYS> dotnet test --filter FirefoxLogging
Determining projects to restore...
All projects are up-to-date for restore.
TestProject -> C:\Users\ozerk\iCloudDrive\PROJECTS\DYS\TestProject\bin\Debug\net8.0\TestProject.dll
Test run for C:\Users\ozerk\iCloudDrive\PROJECTS\DYS\TestProject\bin\Debug\net8.0\TestProject.dll (.NETCoreApp,Version=v8.0)
Microsoft (R) Test Execution Command Line Tool Version 17.8.0 (x64)
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.

Passed!  - Failed:     0, Passed:     1, Skipped:     0, Total:     1, Duration: 7 s - TestProject.dll (net8.0)

ozerkon avatar Feb 15 '24 12:02 ozerkon

@ozerkon I'm not sure how to ready / parse your reply. Does it mean that the test, which was failing before, now passes? I don't see a failure in the listed output.

If not then I really need the geckodriver trace logs for further investigations.

whimboo avatar Feb 15 '24 16:02 whimboo