cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

This product reached the end of support date on March 31, 2021.

Selenium RC

andre_vdveen
DynaMight Pro
DynaMight Pro

Hi,

Do we support integration with Selenium RC, or only WebDriver? I understand they work differently and I have a client who's using Selenium RC but says our integration into 6.5 (using UEM, not Browser Agent) isn't working.

Thanks in advance,

Andre

13 REPLIES 13

sonja
Dynatrace Pro
Dynatrace Pro

Hi Andre,

looking at the specification of Selenium RC, I think this should work as well.

I would recommend your client to check first if any UEM visits are being captured when running the test. If no visits are captured, I would start by troubleshooting that (e.g. proxy blocking the monitor signal, ...). Once you see visits, you should be able to move on to integrating with test automation.

Sonja

Hi Sonja,

Appreciate your comment, I'll check that but it sounds to me like they've added the required tags, but now their script is breaking.

Unfortunately I don't know Selenium at all, so I'm going on what they've sent me...

Quoting the client:

I have tried to implement this method as indicated in the documentation. The documentation relates to selenium Webdriver and not selenium RC I managed to find the equivalent process in selenium RC, but it does not work I have tested the method and it works but it does not like the command Is there any other possible ways of implementing the same process?

if they are talking about the code to define the testname and testrunid (as described here: https://community.dynatrace.com/community/display/DOCDT65/UI-Driven+Browser+Test#UI-DrivenBrowserTest-Integration), then they should make sure it is being called once the web page they are testing is already loaded into the browser. I have seen a similar case at the customer where the call was done to early (browser not ready to process it) and crashing the browser.

hope that helps!

I checked earlier, their UEM data is coming through.

This is what they're passing in their script:

selenium = new DefaultSelenium("localhost", 4444, "*firefox", "http://hostname:8080/app/");

selenium.start();
selenium.open("/app");
selenium.getEval("sessionStorage.DT_TESTNAME = \"myTest\";");

I don't have a dev background, so difficult to say if the above is correct...but I'll ask a colleague, perhaps he can check and assist.

the code looks good to me, but it is likely possible that they are doing it to early. Selenium might just be starting to load the page and the browser might not yet be ready for JavaScript commands.

I would recommend to add a check to see if the page is ready before executing the last line (e.g. something similar to the Web Driver command: wait.until(ExpectedConditions.elementToBeClickable(By.id("iceform:destination"))); ).

Or try to put that line a little bit later in the code - e.g. just before clicking on a element.

You also need to make sure that UEM captures at least one more action "after" you set the testname. otherwise the testname just sits there in the browser but is never sent to the web server as part of the dynatrace monitor signal

two options that i see

#1: click on another link

#2: execute dynaTrace.endVisit() at the end of your test. that I THINK (not 100% sure) will also send metadata. You can verify it in client debug mode and look at the details of the endVisit user action

thiago_campos1
Participant

You can install one of plugins in the browser you'll go to run Selenium tests and tag it with X-Dynatrace tag.

You'll be able to tag calls from Selenium. Actually, i'm working on a plugin for it 😄

Hey Thiago. Cool to know you work on a plugin 🙂

What Andre is trying to do here uses UEM - which means- there is no need to tag the HTTP Requests with X-Dynatrace as the Dynatrace JavaScript Agent automatically takes care of detecting Visits + User Actions and links them to the backend PurePaths. What we are trying to do here is to tell the JavaScript agent which test name is currently executing. We showed this type of test automation integration in the latest perf clinic: https://www.youtube.com/watch?v=-OSSKwD4WKQ&index=...

Andi

andre_vdveen
DynaMight Pro
DynaMight Pro

If anyone out there can check and verify the code below, I'd appreciate it immensely.

The client passed this on to me, as the code they're using in Selenium RC (partial section of the script's Java code, but it includes the DT tag):

package requests;

import id.Products;
import selinium.GenericRequests;
import selinium.SelinuimRelatedRequests;

public class QuoteForInsurance {
private SelinuimRelatedRequests cliek;
private Products product;
private GenericRequests use;

public QuoteForInsurance() {
cliek = SelinuimRelatedRequests.getInstance();
product = new Products();
use = GenericRequests.getInstance();
}

public void quoteForInsurance(String productName, String memberNumber, String startDate) {


cliek.cliekAndWait("link=Quote For Insurance");
cliek.select("name=agreementKind", productName);
cliek.type("id=startDate", startDate);
use.save();
cliek.skript("sessionStorage.DT_TESTNAME = \"myTest\";");
cliek.cliekAndWait("id=add50851");
cliek.cliec("link=Search Results");

They say that with the reference to DT in the script, they get an exception error:

Exception in thread "AWT-EventQueue-0" com.thoughtworks.selenium.SeleniumException: ERROR: Threw an exception: 
at com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:109)
at com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:103)
at com.thoughtworks.selenium.HttpCommandProcessor.getString(HttpCommandProcessor.java:272)
at com.thoughtworks.selenium.DefaultSelenium.getEval(DefaultSelenium.java:479)
at selinium.SelinuimRelatedRequests.skript(SelinuimRelatedRequests.java:125)
at requests.QuoteForInsurance.quoteForInsurance(QuoteForInsurance.java:25)
at selinium.ToMain.quotePDP(ToMain.java:234)
at observers.FirstRunObserver.update(FirstRunObserver.java:88)
at actionListeners.FirstRunActionListener.actionPerformed(FirstRunActionListener.java:12)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)


Any ideas would be most welcome!

The initialisation is done in the Selenium class and then called in the code for the additional class

public void skript(String string) {
selenium.getEval(string);
}

andre_vdveen
DynaMight Pro
DynaMight Pro

Update: turns out the exception was browser related! They initially used IE, but then tried FF or Chrome and the script then runs fine.

thanks for the update! I was running out of ideas 😉

For IE, it could be that a security settings is preventing selenium from running JavaScript code or from using the JavaScript object sessionStorage.

Pleasure! Hahaha, us both!! 😉 Hopefully this post will help someone in future to not fall into the same trap.

This just gave me a few extra grey hairs and one more reason to hate IE, lol!