mozilla / geckodriver

WebDriver for Firefox
https://firefox-source-docs.mozilla.org/testing/geckodriver/
Mozilla Public License 2.0
7.03k stars 1.51k forks source link

Geckodriver is throwing an error using with flutter #2124

Closed sawanS closed 10 months ago

sawanS commented 11 months ago
Screenshot 2023-08-02 at 9 32 12 PM Screenshot 2023-08-02 at 9 32 31 PM

Using flutter integration test for web automation.So, using .sh file running couple of test on firefox browser. Firefox browser version: 116 (latest) Geckodriver version: 0.33.0

Below is my .sh file:

env=$1 ./configure-web.sh $env

flutter clean flutter pub get

echo "Initializing firefox driver" geckodriver --port=4444 --log error >/dev/null & _pid=$! echo "$_pid"

run_test () { echo "=============================== Starting new test script execution ==============================="

if flutter drive --driver=integration_test/test_driver/integration_test.dart --target=integration_test/website_Automation/testScripts/$testScriptName.dart -d web-server --browser-name=firefox --flavor $env --dart-define=environment=$env --dart-define=listenForOtp=false --no-sound-null-safety --no-headless

then echo "** ✅ Test Passed " else echo " ❌ Test Failed **" sleep 10 fi }

if [ "$env" = "QA" ] then run_test demo_web_test fi

rm -r demo_web_test

echo "Closing firefox driver" echo "$_pid" kill -9 "$_pid"

Console Output:

When I was initiating geckodriver instance like below then was getting console wad flooded with unwanted logs

echo "Initializing firefox driver" geckodriver --port=4444 echo "$_pid"

But When I was initiating geckodriver instance like below then was getting proper logs:

echo "Initializing firefox driver" geckodriver --port=4444 --log error >/dev/null & _pid=$! echo "$_pid"

Scenario:

If I am running 1 test in sh file and which is working fine then no issues but let say I am running 2 tests from sh file and 1st one got passed successfully but 2nd one got failed due to some reason then geckodriver is not closing immediately. It is taking almost 20 min time to close the geckodriver instance and then at the end it says browser quits unexpectedly! Please find attached snapshot for logs for reference:

whimboo commented 11 months ago

Could you please enable trace logging for geckodriver by passing --log trace instead? Then please attach the full trace log. It might be that geckodriver also waits for the Firefox process to have exited and that Firefox takes a long time for shutdown. The trace log could give an indication. Thanks!

sawanS commented 11 months ago

@Mozilla-GitHub-Standards @moz-hwine @whimboo - Logs are too long. Geckodriver log.txt please find complete logs in attached text file.

whimboo commented 11 months ago

Thank you for the log! It was helpful. So the problem here is that the tab in Firefox is crashing. See the A content process crashed and MOZ_CRASHREPORTER_SHUTDOWN is set, shutting down line in the log. When such a thing happens Firefox is force closed.

I would appreciate if you could try to extract the minidump files of the crash and attach it here. Just follow our documentation at https://firefox-source-docs.mozilla.org/testing/geckodriver/CrashReports.html. Thanks!

sawanS commented 11 months ago

@whimboo can you guide how can we extract the minidump files of the crash using flutter as we are using flutter project and getting this issue. Also, I would request you to suggest me something which solves my firefox problem asap as It is blocking us to run test on firefox browser.

Note:-----> Why some tests are working and why it is getting crashed for some test. Ideally, If it's crash issue then It should happen for all the test which I am running in firefox.

Thanks

whimboo commented 11 months ago

Please follow the steps in the documentation. Basically you have to pre-create a Firefox profile that is then used with geckodriver. Important is that it is not getting removed after the test ends. Then the minidumps will be present in this profile folder under minidumps.

sawanS commented 11 months ago

@whimboo can you please suggest any solution for this crash issue. However, I will create firefox profile using documentation but will that resolve my browser crashing problem?? If not, then suggest me some solution which resolve browser crashing problem. Thanks!

whimboo commented 11 months ago

So how should I suggest a solution when I do not know anything about this crash yet? As said please send the minidump files and then I can have a look how to resolve the problem.

sawanS commented 11 months ago

@whimboo - I got minidump folder created for firefox profile but I saw minidump folder is completely empty and did not find anything in that folder. Can we do anything else to figure out this issue? Thanks.

whimboo commented 11 months ago

Did you configure geckodriver to use this profile folder? Was it correctly populated with various files after running the test? Alternatively try to catch the error and add a sleep to the test if possible. Then you could manually check via about:crashes if a recorded crash report is available. If you can submit it I would need the URL of the report.

sawanS commented 10 months ago

@whimboo yes I configured geckodriver to profile folder but I can not see any file populated on that location. Also, checked about:crashes but there is no crash report is available in firefox.

whimboo commented 10 months ago

Hm, that is strange. And I do not have an explanation for it other than that the test when setup with a custom profile doesn't trigger a crash. Would you mind running it again and attaching the log to this issue? I would like to see if the content process really crashes.

Do you see this failure only on a single platform or on any one? I assume there is no way for you to have a minimized testcase available?

sawanS commented 10 months ago

@whimboo - I am seeing this crash only for firefox not for other browsers. Also, I am getting same logs which we were getting earlier. Geckodriver.log (4).txt

whimboo commented 10 months ago

Having a look at the log I can see that a profile from /var/folders/jr/8x2sjv2d26d6wcx1dxmb_yqc0000gn/T/rust_mozprofileO8MziW is used. That is randomly generated by geckodriver if no specific path has been provided to the driver. So this means you do not use the --profile capability correctly to specify which profile geckodriver has to use. Alternatively you can also set the following Firefox argument so that Firefox directly accesses this profile:

{"args": ["-profile", "/path/to/your/profile"]}

sawanS commented 10 months ago

@whimboo - Please find the logs generated after passing below profile argument. geckodriver --port=4444 --profile-root="/Users/admin/Library/Application Support/Firefox/Profiles/ist3ihlq.Automation-1691764487524/" geckodriverLog.txt

whimboo commented 10 months ago

Well, I don't need the log itself but the actual minidump files that I requested before. Please check within the given profile's folder if there are files under minidumps/.

sawanS commented 10 months ago

@whimboo As I said already minidump folder is available but there is no files in it. You can see expanded minidump folder in attached snapshot.

Screenshot 2023-08-17 at 3 42 48 PM
whimboo commented 10 months ago

Again, you want that geckodriver uses the profile from ist3ihlq.Automation-1691764487524, but here you have again a temporary one. it's not --profile-root that you can use but set the profile capability under moz:firefoxOptions instead.

whimboo commented 10 months ago

@sawanS do you have an update regarding the requested information? Thanks.

whimboo commented 10 months ago

No response from reporter. Happy to reopen the issue once the requested information is available.