Firefox crashes after the url is being passed onto address bar - jmeter

I am facing an issue with the Web driver sampler in J meter.
I have written a simple code in web driver sampler where i have given a url and passing few credentials to login.
When i run the test.. the browser gets invoked, the url is passed onto the address bar and then
the browser gets closed or crashes. Sometimes the browser gets crashed after passing the passwords. Pls have a look at the below code and let me know
if i am missing on something.
Code.
var pkg=JavaImporter(org.openqa.selenium) //import java selenium package
var support_ui=JavaImporter(org.openqa.selenium.support.ui.WebDriverWait)
var ui=JavaImporter(org.openqa.selenium.support.ui)
var wait=new support_ui.WebDriverWait(WDS.browser,20000)
WDS.sampleResult.sampleStart()
WDS.browser.get('https://web2qa.westlaw.com/signon/default.wl?bhcp=1&fn=_top&newdoor=true&rs=WLW14.07&vr=2.0')
var Onepass=WDS.browser.findElement(pkg.By.id('OnePassHeaderLink'))
Onepass.click()
var usernameField = WDS.browser.findElement(pkg.By.id('pwd'))
usernameField.sendKeys(['pwd1'])
var passwordField = WDS.browser.findElement(pkg.By.id('clientid'))
passwordField.sendKeys(['pwd2'])
var loginButton=WDS.browser.findElement(pkg.By.id('login_submit'))
loginButton.click()
WDS.log.info(WDS.name + ' has logged an entry')
WDS.sampleResult.sampleEnd()
1.I did reduce the timeout period, Still the Issue persists.
2.i have added the code u mentioned even in the username Field and passwordField still the browser crashes once the page gets loaded.
3.Please find the screenshot and the error log below.
Error Log:
2014/07/22 01:27:56 INFO - jmeter.threads.JMeterThread: Running PostProcessors in forward order
2014/07/22 01:27:56 INFO - jmeter.threads.ThreadGroup: Started thread group number 1
2014/07/22 01:27:56 INFO - jmeter.engine.StandardJMeterEngine: All thread groups have been started
2014/07/22 01:27:56 INFO - jmeter.threads.JMeterThread: Thread started: Thread Group 1-1
2014/07/22 01:28:09 INFO - com.googlecode.jmeter.plugins.webdriver.config.WebDriverConfig: iterationStart()
2014/07/22 01:28:09 INFO - com.googlecode.jmeter.plugins.webdriver.sampler.WebDriverSampler: Current thread name: 'Thread Group 1-1', has browser: 'FirefoxDriver: firefox on XP (098965b0-fea8-4428-9e6e-76d1385cecc2)'
2014/07/22 01:28:22 ERROR - com.googlecode.jmeter.plugins.webdriver.sampler.WebDriverSampler: sun.org.mozilla.javascript.internal.WrappedException: Wrapped org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"id","selector":"login_submit"}
Command duration or timeout: 32 milliseconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.34.0', revision: '11cd0ef93615408e0b6b3bfa28defe125906461a', time: '2013-08-06 11:43:14'
System info: os.name: 'Windows 2003', os.arch: 'x86', os.version: '5.2', java.version: '1.6.0_37'
Session ID: 098965b0-fea8-4428-9e6e-76d1385cecc2
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{platform=XP, acceptSslCerts=true, javascriptEnabled=true, browserName=firefox, rotatable=false, locationContextEnabled=true, version=16.0.2, cssSelectorsEnabled=true, databaseEnabled=true, handlesAlerts=true, browserConnectionEnabled=true, nativeEvents=true, webStorageEnabled=true, applicationCacheEnabled=true, takesScreenshot=true}] (#18) in at line number 18
2014/07/22 01:28:22 INFO - jmeter.threads.JMeterThread: Thread finished: Thread Group 1-1
2014/07/22 01:28:22 INFO - jmeter.engine.StandardJMeterEngine: Notifying test listeners of end of test
2014/07/22 01:28:22 INFO - jmeter.gui.util.JMeterMenuBar: setRunning(false,local)

First of all WebDriverWait(WDS.browser,20000)
Are you sure that 20000 seconds is correct timeout for waiting element to appear? It's 5.5 hours. If you need 20 seconds just put 20 in there.
Second:
Elements may not be loaded immediately after browser.get request. For instance if element is being loaded with AJAX it may take some additional time for it to appear in DOM and WebDriver could interact with it.
So I would suggest something like:
WDS.browser.get('https://web2qa.westlaw.com/signon/default.wl?bhcp=1&fn=_top&newdoor=true&rs=WLW14.07&vr=2.0')
wait.until(ui.ExpectedConditions.presenceOfElementLocated(pkg.By.id('OnePassHeaderLink')))
var Onepass=WDS.browser.findElement(pkg.By.id('OnePassHeaderLink'))
Onepass.click()
Apply the same for usernameField, passwordField, etc.
Third: If you still experience any problems add View Results Tree listener or inspect jmeter.log file to find out the reason of your test failure and update your question with error messages as Stack Overflow community is not telepathic enough to guess what's wrong with your test.
See Using Selenium with JMeter's WebDriver Sampler guide for more details on how to use WebDriver Sampler.

Related

JMeter WebDriver Sampler doesn't work and doesnt have headless

I am using jp#gc - Firefox Driver Config plugin to hit some URL and assert some element in UI.
But I am not able to launch firefox driver as I cant see an option to enable to run firefox as a headless browser .
JP#GC - WebDriver Sampler:
import org.openqa.selenium.By;
import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait
def wait = new WebDriverWait(WDS.browser,5000);
WDS.sampleResult.sampleStart(); WDS.browser.get('https://google.com/'); wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(".//input[#name='q']"))); WDS.sampleResult.sampleEnd()
How about checking Headless box in the jp#gc - Firefox Driver Config?
Going forward be aware that you can always bypass any JMeter limitation by implementing whatever you want/need using JSR223 Test Elements and Groovy language, example code to kick off a headless Firefox would be something like:
System.setProperty('webdriver.gecko.driver','c:/apps/webdriver/geckodriver.exe')
def options = new org.openqa.selenium.firefox.FirefoxOptions()
options.addArguments('--headless')
def driver = new org.openqa.selenium.firefox.FirefoxDriver(options)
driver.get('http://example.com')
log.info('Current page title: ' + driver.getTitle())
driver.quit()
More information on Groovy scripting in JMeter: Apache Groovy - Why and How You Should Use It

Axon Server - send events when the application starts

My situation is as follows:
I have two microservices. When the first emits an event, the other correctly receives it;
If the first emits an event and the second microservice is off, when I turn on the second microservice, it does not receive the event.
edit:
I'm trying saga, when I issue a command I get it on the second service only if it is on.
the error I get is:
2020-04-06 13:53:40.341 WARN 1188 --- [-worker-ELG-3-1] i.a.a.message.command.C
ommandDispatcher : No Handler for command: com.progressivecoder.ecommerce.comma
nds.CreateInvoiceCommand
2020-04-06 13:54:38.707 WARN 1188 --- [nio-8024-exec-8] .w.s.m.s.DefaultHandler
ExceptionResolver : Async request timed out
2020-04-06 13:54:41.514 WARN 1188 --- [nio-8024-exec-8] .w.s.m.s.DefaultHandler
ExceptionResolver : Resolved [org.springframework.web.context.request.async.Asyn
cRequestTimeoutException]
2020-04-06 13:55:01.699 WARN 1188 --- [nio-8024-exec-9] .w.s.m.s.DefaultHandler
ExceptionResolver : Async request timed out
2020-04-06 13:55:01.700 WARN 1188 --- [nio-8024-exec-9] .w.s.m.s.DefaultHandler
ExceptionResolver : Resolved [org.springframework.web.context.request.async.Asyn
cRequestTimeoutException]
reading the guide, I realized that I have to configure the command bus to work in asynchronous;
is there an example from which I can get ideas?
thanks.
In Axon Server do you see the event that you emitted when you run a query in the search tab? Do you see the second microservice in the overview tab and does it show the tracking event processor in the application details?
Marc

Debugging topshelf as a service

I am having problems running TopShelf as a service and I am not getting much info to help troubleshoot. I am using dotNet core 2.2.
I get this error when I start it:
Error: 1053: The service did not respond to the start or control
request in a timely fashion.
Event logs show:
A timeout was reached (30000 milliseconds) while waiting for the Test service to connect.
The Test service failed to start due to the following error: The service did not respond to the start or control request in
a timely fashion.
It message shows a 30 second timeout in the error popup happens in about 1 second. I don't think its a time out.
I my current setup I am using an IHostedService, but I have tried it without this. Here is the current setup.
var hostBuilder = SetupHost();
var rc = HostFactory.Run(x =>
{
x.Service<IHost>(s =>
{
s.ConstructUsing(name => hostBuilder.Build());
s.WhenStarted(tc =>
{
_logger = tc.Services.GetRequiredService<ILogger<Kickoff>>();
tc.StartAsync();
});
s.WhenStopped(tc => tc.StopAsync());
});
x.RunAsLocalService();
x.SetDescription("Test");
x.SetDisplayName("Test");
x.SetServiceName("Test");
x.EnableShutdown();
x.OnException(p => ExceptionOccured(p));
});
If you see something glaring people let me know.
My main goal is to find a technique to troubleshoot this. I've tried logging to a file with system.io but it does not produce results. I don't know how to debug it or get meaning information.

How can I reconnect Selenium to IE11 after navigating with the prerender resource hint?

I'm working on a Selenium (Ruby API) test that navigates from one page to another. It started failing on IE11/Win10 (via SauceLabs) recently when I added a link rel="prerender" resource hint on the first page pointing to the second page, to speed up navigation. The failure is this (see full backtrace) and consistently occurs on the first Selenium command after navigation occurs.
Unable to find element on closed window (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 4 milliseconds
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'WIN-SB3ER6JQ6ME', ip: '172.20.114.237', os.name: 'Windows 10', os.arch: 'x86', os.version: '10.0', java.version: '1.8.0_91'
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Capabilities [{browserAttachTimeout=0, ie.enableFullPageScreenshot=true, enablePersistentHover=false, ie.forceCreateProcessApi=false, ie.forceShellWindowsApi=false, pageLoadStrategy=normal, ignoreZoomSetting=false, ie.fileUploadDialogTimeout=3000, version=11, platform=WINDOWS, nativeEvents=false, ie.ensureCleanSession=false, elementScrollBehavior=0, ie.browserCommandLineSwitches=, requireWindowFocus=false, browserName=internet explorer, initialBrowserUrl=about:blank, javascriptEnabled=true, ignoreProtectedModeSettings=false, enableElementCacheCleanup=true, unexpectedAlertBehaviour=dismiss}]
Session ID: XXXXXXXX-XXXX-XXXX-XXXX-XXXX79d496ee
*** Element info: {Using=class name, value=dialog-title} (org.openqa.selenium.NoSuchWindowException) (Selenium::WebDriver::Error::NoSuchWindowError)
For what it's worth, the prerendering works fine when testing IE11 manually, and Selenium+Chrome (which also respects the prerender directive) has no problem with this.
My suspicion is that IE implements the prerender by loading the page in a hidden window/context, then destroying the current window and swapping in the new one upon navigation - causing Selenium's handle on the window to become invalid. I've already attempted to work around this by trying to force Selenium to reconnect to the window:
# Wait a few seconds, then
#driver.switch_to.window(#driver.window_handles.last)
But I've discovered that #driver.window_handles is empty after navigation, even though the SauceLabs screencast shows the navigation working properly.
Is there any way to reconnect Selenium to IE11 after navigating with the prerender resource hint?

Alfresco 5.0 Community unable to create folders within share

I am trying to deploy Alfresco Community 5.0 on Windows Server 2012 R2, with IIS 8 and I have run into a little bit of a pickle. Currently, everything seems to be functioning as expected except for the creation of folders. I can add files and users, so I'm not really sure where to start.
When I try to create a new folder within the share site I am prompted with "Could not create 'new folder'. Duplicate folder name?" and I am entering a random name.
I checked the alfresco.log file and there is nothing in there.
If you need any extra information let me know.
IIS threw this exception.
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 3/10/2015 9:13:17 AM
Event time (UTC): 3/10/2015 3:13:17 PM
Event ID: 2a27fe7511504646bdc5cf85b4f428c1
Event sequence: 90
Event occurrence: 5
Event detail code: 0
Application information:
Application domain: /LM/W3SVC/1/ROOT-1-130704715600439291
Trust level: Full
Application Virtual Path: /
Application Path: C:\inetpub\wwwroot\
Machine name: WEDNESDAY
Process information:
Process ID: 3352
Process name: w3wp.exe
Account name: IIS APPPOOL\DefaultAppPool
Exception information:
Exception type: HttpException
Exception message: A potentially dangerous Request.Path value was detected from the client (:).
at System.Web.HttpRequest.ValidateInputIfRequiredByConfig()
at System.Web.HttpApplication.PipelineStepManager.ValidateHelper(HttpContext context)
Request information:
Request URL: http://wednesday/share/proxy/alfresco/api/type/cm:folder/formprocessor
Request path: /share/proxy/alfresco/api/type/cm:folder/formprocessor
User host address: 10.000.00.00
User:
Is authenticated: False
Authentication Type:
Thread account name: IIS APPPOOL\DefaultAppPool
Thread information:
Thread ID: 8
Thread account name: IIS APPPOOL\DefaultAppPool
Is impersonating: False
Stack trace: at System.Web.HttpRequest.ValidateInputIfRequiredByConfig()
at System.Web.HttpApplication.PipelineStepManager.ValidateHelper(HttpContext context)
asp.net 4.0 has quite extensive url validation. When Alfresco creates a folder it uses alfresco/api/type/cm:folder/formprocessor as the url. The validation rejects the use of : in url's so I added a regex function within my asp.net web.config file.
system.web>
httpRuntime requestPathInvalidCharacters="<,>,%,&,\,?" />
/system.web>
All of the other special characters are still getting validated, but I did not include ":" so now the url is allowed through.

Resources