Each time I run my selenium script, which uses a Chrome Webdriver, I find that at the end of the execution, I have significantly (~50 Mb) less memory in my drive. I am not pulling/storing data anywhere, I am just instructing it to complete a series of clicks to navigate some UI, so why would this be happening? I suspect that is has to do with my webdrivers never actually quitting, but I'm not sure why that would be the case? If I close out of the chrome page being run by selenium prematurely, I'm assuming the driver closes too? And in the case where it does conclude running, I explicitly program the driver to quit.
Additionally, I can no longer open chrome through my desktop. It simply won't start.
Can someone give me some advice or enlighten me about what is actually taking place behind the scenes to cause this problem?
When execution starts chromedriver creates some temp directories in this location :
C:\Users\username\AppData\Local\Temp
these directories starts with name like "scoped_dir8952_11195" and every directory created by chrome in temp folder starts with "scoped_dir".
when driver.quit() or close() is called it should be deleted but if it is not getting deleted then you have to delete it after execution using java code or you can simply create a .bat file that deletes the directories starting with name "scoped_dir" and then can execute it using ProcessBuilder or Runtime.exec() .
You can also manually delete them if you want.
Hope that helps you.
Related
We have our Health Check automated wherein all of our applications are logged onto, all via Selenium and only on Internet Explorer.
The code runs well when it was executed directly from a batch file. However, when Jenkins calls this batch (.bat) file, it doesn't execute it completely.
BTW the platform is Windows Server 2008 R2 Standard
This is the .bat file code
#echo off
set path="";
set path="E:\XXXX\jre1.8.0_141\bin";
pushd E:\Jenkins_Softwares\SeleniumCode\HealthCheck_jar
SET JAVA_OPTS=-Xmx4g -Xms512m -XX:MaxPermSize=256m -XX:ReservedCodeCacheSize=128m -XX:MaxHeapSize=512m
java -jar HealthCheck_JenkinsNG.jar
I've added these additional IE options in the JAVA code before launching the IE driver.
InternetExplorerOptions options = new InternetExplorerOptions();
options.introduceFlakinessByIgnoringSecurityDomains();
options.enableNativeEvents();
options.destructivelyEnsureCleanSession();
When Jenkins executes the batch file, the IE browser opens into the Login page. There's something odd when this page is displayed - the entire page alignment is disrupted and all elements get aligned to the left. (I'd like to stress that when the batch file is instead executed directly, there is no such page alignment disruption. The elements retain their original centre position. For some reason, Jenkins sets all of this to the left). The alignment is not exactly a deal breaker for me.
However, when username and password is entered via the Selenium code, it types into the perfect text boxes; but when the submit button is hit, the content in these textboxes turn blank and I'm unable to login. (When this same piece of code is executed via running the batch file directly, I'm able to login and The homepage of my application is displayed)
I doubt if there's something wrong with the selenium java code. Since, it executes properly, when run from the .bat file or even command line or even as a Java Application from an IDE.
For some reason, when this is executed from Jenkins it does not work.
Is there any options or settings that needs to be set when Jenkins works with Selenium on IE 11? Because I've tried tweaking the selenium code so much, they all yield the same result - The elements on the Login page get cleared after the submit button is clicked.
Also, just to mention, all of this is run on one Master node of Jenkins only. There are no slave nodes.
You need to take care of a couple of things as follows:
For the build process Jenkins would need the path of jdk. Simply jre may not suffice.
JDK 8u141 is ancient now and you need to upgrade to latest JDK 8u202
introduceFlakinessByIgnoringSecurityDomains() (in Java) and IntroduceInstabilityByIgnoringProtectedModeSettings() (in DotNet) is not an ideal solution to address the issues croping out of Protected Mode settings.
Here you can find a detailed discussion in Internet Explorer Protective mode setting and Zoom levels
To work with Selenium, InternetExplorerDriver and InternetExplorer you need to fulfill the Required Configuration
I have only 3 test cases on a spec file -but when i run this spec -cypress runner often crashes chrome browser.
And i have to restart again.
Is this is something with my code ? or is there any solutions for this
Thanks
Try setting the numTestsKeptInMemory: 5, the default value might be 50. This way was can reduce the memory consumption. Save the configuration, close and star the app again.
Avoid writing lengthy tests and split the test file into multiple test/spec files.
I'm not sure what is going on, but every time I run my application (vb.net) Chromedriver eats disk space. I even added another 40GB (Virtual Machine) and now that is gone!
I'm doing the typical:
Dim driver as ChromeDriver = New Chromedriver
driver.Navigate.GoToUrl.....
both on form load, essentially. I constantly re-work the code, so I exit out and have to manually close the console window, maybe that is causing the issue. Will have to put some ChromeDriver destroying instead of letting garbage collection manage that.
HOWEVER:
Where are these files so that I can delete them?
Most likely the files are folders named scoped_dir* inside C://Users/user/AppData/Local/Temp. You can type %APPDATA% in the search window on your taskbar to go to AppData folder and then remove those scoped folders.
I am running my spec flow feature files with the help of resharper and certain feature files have been ignored for later use with #ignore tag. What happens is that chromedriver opens these tests, realizes that they are ignored and stop the test. As I run the tests from a folder, it takes upto 5 mins for every folder that contain these ignored tests. Is there a way to prevent the test runner,runnning these ignored tests so that I can save some time ?
That really depends on where you are starting chromedriver from. If you are starting the driver in a [BeforeScenario] step then yes. Its as simple as this:
if(!ScenarioContext.Current.ScenarioInfo.Tags.Contains("ignore")){
//start chromedriver
}
in this way you can check to make sure if the current scenario should be ignored or not and avoid starting chromedriver if it is.
I have a test using Webdriver and C# which downloads a file from a website.
When running this test on my local machine it works fine but when I try to run it on Selenium grid it Looks for the file I'm downloading on the hub and not on the node.
Is the anyway of accessing the node file structure to monitor when the file is downloaded.
Sorry if this is unclear.
Thanks
Aidan
It seems, there is no such possibility.. I have also tried to find such functionality, but failed.
But, one way to check it still exists - "upload downloaded". Of course it is workaround and not always you have such function as upload.
Anyway, you may:
download test data
delete test data from page
upload test data on page again
check it was really appeared
It is quite dirty way, but on other hand it allows you to test not only download function, but also upload function.