Unable to open DISPLAY with JavaFX on ubuntu server - java

I have a simple Application which generates a png of a chart which is based on JavaFX. The app fails to run on displayless machine with the following exception, I don't need to render or display content on the console, just need to create the image.
"main" java.lang.UnsupportedOperationException: Unable to open DISPLAY
at com.sun.glass.ui.gtk.GtkApplication.<init>(GtkApplication.java:68)
at com.sun.glass.ui.gtk.GtkPlatformFactory.createApplication(GtkPlatformFactory.java:41)
at com.sun.glass.ui.Application.run(Application.java:146)
at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:257)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:211)
at javafx.embed.swing.JFXPanel.initFx(JFXPanel.java:215)
at javafx.embed.swing.JFXPanel.<init>(JFXPanel.java:230)
I'm trying to run this on a AWS instance. Is there a way to overcome this issue? Following is my sample code.
import javafx.application.Platform;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.embed.swing.JFXPanel;
import javafx.embed.swing.SwingFXUtils;
import javafx.scene.Scene;
import javafx.scene.chart.PieChart;
import javafx.scene.image.WritableImage;
import javafx.stage.Stage;
import java.io.File;
import java.io.IOException;
import java.nio.file.Paths;
import javax.imageio.ImageIO;
public class Test {
public static void main(String[] args) {
String chartGenLocation = "/Users/tmp";
new JFXPanel();
ObservableList<PieChart.Data> pieChartData =
FXCollections.observableArrayList(
new PieChart.Data("Failed", 10),
new PieChart.Data("Skipped", 20));
final PieChart chart = new PieChart(pieChartData);
chart.setAnimated(false);
Platform.runLater(() -> {
Stage stage = new Stage();
Scene scene = new Scene(chart, 500, 500);
stage.setScene(scene);
WritableImage img = new WritableImage(500, 500);
scene.snapshot(img);
File file = new File(Paths.get(chartGenLocation, "a.png").toString());
try {
ImageIO.write(SwingFXUtils.fromFXImage(img, null), "png", file);
} catch (IOException e) {
//logger.error("Error occurred while writing the chart image
}
});
}
}
I have seen few SO answers which mostly talk about monocle and testfx, here I'm unable to add external dependencies. So adding testfx is not a option. I have also tried the following with xvbf, which hangs the system,
Xvfb :95 -screen 0 1024x768x16 &> xvfb.log &
export DISPLAY=:95.0
When I execute I see the following output and system hangs there.
(process:13112): Gtk-WARNING **: Locale not supported by C library.
Using the fallback 'C' locale.
Fontconfig warning: ignoring UTF-8: not a valid region tag
Update
Execution Sequence
Xvfb :92 -screen 0 1024x768x16 &> xvfb.log &
export DISPLAY=:92.0
No errors in xvbf.log, seems to start properly.
java Test
I see following in console out
(process:13356): Gtk-WARNING **: Locale not supported by C library.
Using the fallback 'C' locale.
Fontconfig warning: ignoring UTF-8: not a valid region tag
I do not see any log in xvbf.log, the execution doesn't proceed after the above log. My image is not getting generated.
Update 2
I would like to know if there is a way to bypass this validation since I really don't need a display rendering.

I hit the same JavaFX issue on Ubuntu server using xvfb as the display manager for my UI tests, the root cause for me was my forwarded DISPLAY wasn't injected into dbus's activation environment, so anything that dbus activates that tries to present a UI failed to connect to a display and resulted in the "Unable to open DISPLAY" exception.
Running dbus-update-activation-environment --systemd DISPLAY XAUTHORITY in that shell before launching the UI tests fixed this issue for me.

Related

What is ImageIO doing when reading a file?

I am a bit confused by ImageIO.read(file). When I try to read a .png file into a BufferedImage, at least on macOS, the focus moves to a new application named after my main class. It appears in the Menu bar. It does so even when I run java from the command line.
The annoying thing is that it moves the focus out of my IDE and I have to return to it manually.
I looked at the source of ImageIO.read(file). I discovered that it is calling ImageIO.createImageInputStream(file) and that is what triggers this behaviour.
My question is: what is ImageIO doing actually, why is my main class showing in the Menu bar when it is just loading information in memory. And most important, how can I avoid it?
Below the code to show the problem. Use any .png to test it.
package misc;
import javax.imageio.ImageIO;
import javax.imageio.stream.ImageInputStream;
import java.io.File;
import java.io.IOException;
public class ReadImageTest {
public static void main(String[] args) {
try {
File file = new File("out/production/resources/picture.png");
long time = System.currentTimeMillis();
ImageInputStream stream = ImageIO.createImageInputStream(file);
long delay = System.currentTimeMillis() - time;
System.out.println("stream: " + stream.length());
System.out.println("time: " + delay/1000.0);
} catch (IOException e) {
e.printStackTrace();
}
}
}
Using Headless Mode in the Java SE Platform describes what is headless mode and how to use it properly.
Headless mode is a system configuration in which the display device,
keyboard, or mouse is lacking. Sounds unexpected, but actually you can
perform different operations in this mode, even with graphic data.
You can enable it by adding below option to your program:
-Djava.awt.headless=true
See also:
What is the benefit of setting java.awt.headless=true?
How can I prevent command line java processes from stealing focus in OSX?
Setting java.awt.headless=true programmatically

OpenCV - Java: VideoCapture read frame hangs with usb camera

I'm quite new to OpenCV - Java programming, and I'm trying to setup an application to read video frames from USB WebCam, to start with something.
This is the document I followed up to now: https://opencv-java-tutorials.readthedocs.io/en/latest/03-first-javafx-application-with-opencv.html#video-capturing
The setup is the following:
Java version: 10.0.1
OpenCV Version: 3.3.4 and 3.2.0, same error with both versions
OS: Windows 10 x64
The .dll is placed under C:\Windows, that is included in my java.library.path
I have some additional frameworks involved in the application, but I prepared an isolated test case to better check the issue:
import org.junit.Test;
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.videoio.VideoCapture;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class CVCaptureTest {
private static final Logger LOG = LoggerFactory.getLogger(CVCaptureTest.class);
#Test
public void testFrameRead() {
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
VideoCapture capture = new VideoCapture();
capture.open(0);
for (int i = 0; i < 100; i ++) {
if (capture.isOpened()) {
Mat frame = new Mat();
LOG.info("Capture open. Reading frame...");
capture.retrieve(frame);
LOG.info("Captured: {}", frame.dump());
}
}
}
}
Output:
[INFO] Running i.m.r.b.r.c.CVCaptureTest
20:15:57.757 [main] INFO i.m.r.b.r.c.CVCaptureTest - Capture open. Reading frame...
After this log line the program just hangs, without throwing any exception.
Any help on understanding the cause of the freeze is welcome.
Thanks & Regards,
Mattia!
Try to use the capture.read(frame);.

VLCJ cant find plugins in normal installation

My VLC.exe works fine with a bit of lag. But my simple VLCJ code does not work.
import javax.swing.JPanel;
import com.sun.jna.NativeLibrary;
import javax.swing.JFrame;
import uk.co.caprica.vlcj.component.EmbeddedMediaPlayerComponent;
import uk.co.caprica.vlcj.runtime.RuntimeUtil;
public class VideoPanel extends JPanel {
private static final String NATIVE_LIBRARY_SEARCH_PATH = "C:/Program Files/VideoLAN/VLC";
private EmbeddedMediaPlayerComponent mediaPlayerComponent;
public VideoPanel() {
NativeLibrary.addSearchPath(RuntimeUtil.getLibVlcLibraryName(), NATIVE_LIBRARY_SEARCH_PATH);
mediaPlayerComponent = new EmbeddedMediaPlayerComponent();
this.add(mediaPlayerComponent);
}
public static void main(String args[]){
JFrame frame = new JFrame();
frame.add(new VideoPanel());
frame.setBounds(100, 100, 800, 450);
frame.setVisible(true);
}
}
I am using 64bit java 1.8.0_60. And I am using vlc 2.2.4 64bit on Windows 10 64bit.
My error message was this.
[00000000018bbbb0] core libvlc error: No plugins found! Check your VLC installation.
Exception in thread "main" java.lang.RuntimeException: Failed to initialise libvlc.
This is most often caused either by an invalid vlc option being passed when creating a MediaPlayerFactory or by libvlc being unable to locate the required plugins.
If libvlc is unable to locate the required plugins the instructions below may help:
In the text below represents the name of the directory containing "libvlc.dll" and "libvlccore.dll" and represents the name of the directory containing the vlc plugins...
For libvlc to function correctly the vlc plugins must be available, there are a number of different ways to achieve this:
1. Make sure the plugins are installed in the "/plugins" directory, this should be the case with a normal vlc installation.
2. Set the VLC_PLUGIN_PATH operating system environment variable to point to "".
More information may be available in the log.
at uk.co.caprica.vlcj.player.MediaPlayerFactory.(MediaPlayerFactory.java:300)
at uk.co.caprica.vlcj.player.MediaPlayerFactory.(MediaPlayerFactory.java:259)
at uk.co.caprica.vlcj.component.EmbeddedMediaPlayerComponent.onGetMediaPlayerFactory(EmbeddedMediaPlayerComponent.java:349)
at uk.co.caprica.vlcj.component.EmbeddedMediaPlayerComponent.(EmbeddedMediaPlayerComponent.java:217)
at VideoPanel.(VideoPanel.java:19)
at VideoPanel.main(VideoPanel.java:31)
What should I do?
This is a not uncommon problem, especially it seems on Windows platforms.
The vlcj introduction tutorial uses this code to find the native library and its plugins:
package tutorial;
import uk.co.caprica.vlcj.binding.LibVlc;
import uk.co.caprica.vlcj.discovery.NativeDiscovery;
public class Tutorial {
public static void main(String[] args) {
boolean found = new NativeDiscovery().discover();
System.out.println(found);
System.out.println(LibVlc.INSTANCE.libvlc_get_version());
}
}
This NativeDiscovery class encapsulates everything needed, including setting the VLC_PLUGIN_PATH environment variable, for the most common cases.
This is the recommended way to make sure LibVLC gets properly initialised with vlcj, so please try it.

Jsoup, HTMLUnit, phantomJS: How can I click on Button OR fill out Formular TO bypass agecheck

I collected URLs from a mainpage (Steam-GameStore) and want to call
each single site, but some of them have an agecheck. I identified two
different types of agechecks:
only a simple button is expected to click
a whole table has to be filled (with concrete specifications of your age)
Here are some pictures where to find it in the HTML-Code
Agecheck type 1
Agecheck type 2
My Question now is:
How can I click on that damn button? In the way, that my for-loop
(which is running through all that 11 thousands URLs) isn't breaking up
and redirect me to that website BEHIND that agecheck (so I can read out data from it)?
I tried it with phantomJS, but this is JavaScript and I dont know how
to include this in my Jsoup-Code. So I'm now trying to do that with
HTMLUnit. Any ideas?
And then I have to fill up a whole form (for the complex
age-check). How can I do this? Is it possible to do this with HTMLunit?
Ok, I solved the problem. In short terms: I switched to Selenium WebDriver (for JavaCode) and Selenium IDE (FireFox Plugin).
________ Elaborately Description (step by step):
1. Install Selenium IDE for FireFox-Browser:
Go to:
!!!FUCK: I'm not allowed to post Links cause of my low reputation. Just want to do some good deeds, but was hindered (Fuck this world!) !!!
h**ps://addons.mozilla.org/en-US/firefox/addon/selenium-ide/
(note: replace the two * with t)
and click on "+ Add to Firefox"-Button. After rebooting Firefox, the
installation will be done.
ATTENTION: It could be, that some errors will occure at this point (the "Selenium IDE"-entry doesn't appear in the menu of Firefox. If that so,
try to install Selenium IDE by Firefox-> Add-ons->Plug ins: search for
Selenium and select:
Selenium IDE 2.9.1.1-signed"
"Highlight Elements (Selenium IDE)"
"Selenium IDE Button 1.2.0.1-signed.1-signed"
Navigate in FireFoxMenu to :
Tools-> Web-DevelopmentExtras-> add new tools:
(don't Know the exact term, cause I'm using german version of Firefox:
-> Web-Entwickler->Weitere Tools laden)
search for Selenium and choose:
"SeleniumX"
After the Installation the "Selenium IDE"-entry appears in the firefoxMenu under: Tools-> Selenium IDE (german: Extras).
2. Install Selenium WebDriver for Eclipse / Dynamic WebProjects:
Got to:
!!!FUCK: I'm not allowed to post Links cause of my low reputation. Just want to do some good deeds, but was hindered (Fuck this world!) !!!
h**p://www.seleniumhq.org/download/#selenium_ide
(note: replace the two * with t)
and download (first section on site): Selenium Standalone Server
=> version 3.0.1 (date: 11.5.16 [month-day-year])
After downloading the .jar-file, copy it to your in
Eclipse into the following folder:
NameofProject\WebContent\WEB-INF\lib
Note: you could import this by "Build Path-> Configure Build Path", but I
prefer this faster way.
Note: For creating a new "Dynamic Web Project" you have to install some
new software in Eclipse: Help-> Install new Software: In the first line
"Work with" choose:
"Luna - FORBITTEN LINK for low REPUTATION-people"
(for Eclipse Luna version, modify it to your Eclipse version!).
WAIT, til Pending... is done and then choose (last entry):
"Web, XML, Java EE and OSGI Enterprise Development)
3. Using Selenium IDE to identify WebElement in HTML-Code by creating "Test cases" and export them as Java-Code to Eclipse:
Detailed Tutorial:
!!!FUCK: I'm not allowed to post Links cause of my low reputation. Just want to do some good deeds, but was hindered (Fuck this world!) !!!
h**p://docs.seleniumhq.org/docs/02_selenium_ide.jsp
(note: replace the two * with t)
3.1. Open FireFox-Browser: Go to WebSite you want to inspect / crawl / parse HTML-Code. Then (after page was loaded) open Selenium IDE (Tools-> Selenium IDE). Assure that the red button (looks like record-button in some Video-Tools)
on the right most position in the menuBar (over "Table / Source"-Tabs) is
activated (you can read a message by MouseOver). While recording, each
CLICK on the Website you want to inspect creates automatically an entry
into the "Table"-tab (a sort of simple Script-Command). Try to execute as
many actions as you can / need on the website you want to crawl, cause
each action gives you the element in the HTML-code and helps you later to
identify it by Java-Code!
3.2. After finishing your "inspectation" by simply MouseClicks, you have
to save your "Test case" you created right now.
File (F) ->Save Test Case: Choose a name you wish and confirm the save-
Process.
Note: the default StoreLocation for your Test cases is the "Mozilla-
FireFox"-folder on your PC (common path: C:\Programs\Mozilla Firefox).
3.3. Export the Test case as JAVA-CODE to Eclipse:
!!!!! This is the most awsome feature of Selenium IDE !!!!!
Now - after saving your Test case - go again in Selenium IDE to:
File (F)-> Export Test Case As:
choose: Java/JUnit 4/WebDriver: again FileChooser opens (default:
FireFox-folder) and now you can save this "Export-File" as a Java-file.
IMPORTANT: the file ending has to be ".java" (e.g.: "IHateLowReputation.java").
Then copy / import it into your Eclipse-Project. Now you can open this
.java-file and inspect the outwritten Java code for the rigth WebElements
you want to find / choose / manipulate.
You can use this to get a feeling, how Selenium Webdriver commands in
Java has to be coded. Copy the required Code-Lines to your Class.
_____________ And here is my SolutionCode for my Problem above:
package fixWrongEntries;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.concurrent.TimeUnit;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
import org.openqa.selenium.phantomjs.PhantomJSDriver;
import org.openqa.selenium.support.ui.Select;
import com.gargoylesoftware.htmlunit.ScriptResult;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlButton;
import com.gargoylesoftware.htmlunit.html.HtmlForm;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlSelect;
import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
import com.gargoylesoftware.htmlunit.html.HtmlTextInput;
import data.DB_Steam_Spiele;
import data.Spiel;
public class SolveButtonClick_FormSubmitt
{
public static void main(String[] args)
{
String agecheckButton = "Content in this product may not be appropriate for all ages, or may not be appropriate for viewing at work.";
String agecheckKonkret = "Please enter your birth date to continue:";
String noReviews = "There are no reviews for this product";
try
{
// turn off annoying htmlunit warnings
java.util.logging.Logger.getLogger("com.gargoylesoftware").setLevel(java.util.logging.Level.OFF);
// Enabling JavaScript => true in brackets
HtmlUnitDriver driver = new HtmlUnitDriver(true);
// Link for agecheck Typ 1 (simply Button click)
String url = "http://store.steampowered.com/app/324800/?snr=1_7_...";
// Link for agecheck Typ 2 (fill out formular and submitt)
//Stng url = "http://store.steampowered.com/agecheck/app/72850/";
driver.get(url);
// System.out.println(driver.findElement(By.cssSelector("h2")).getText());
System.out.println(driver.getCurrentUrl());
/*********************************************************************
*
* Agecheck Typ 2
*
*********************************************************************/
if(driver.findElement(By.cssSelector("h2")).getText().equals(agecheckKonkret))
{
System.out.println("Achtung: Agecheck konkret!");
// Fill out form with age-specifications:
new Select(driver.findElement(By.name("ageDay"))).selectByVisibleText("18");
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
new Select(driver.findElement(By.name("ageMonth"))).selectByVisibleText("April");
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
new Select(driver.findElement(By.id("ageYear"))).selectByVisibleText("1970");
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
// Click AgeCheck Formular Button: Fortfahren
driver.findElement(By.cssSelector("a.btnv6_blue_hoverfade.btn_small > span")).click();
if(driver.findElement(By.id("app_reviews_hash")).getText().contains(noReviews))
{
System.out.println("Keine Reviews vorhanden!");
continue;
}
else if(!driver.findElement(By.id("app_reviews_hash")).getText().contains(noReviews))
{
String all = driver.findElement(By.xpath("//div[#id='app_reviews_hash']/div[3]/div[2]/label"))
.getText();
String steamPurchaser = driver.findElement(By
.xpath("//div[#id='app_reviews_hash']/div[3]/div[2]/label[2]")).getText();
String communityURL = driver.findElement(By.cssSelector("a.btnv6_blue_hoverfade.btn_medium"))
.getAttribute("href");
}
}
/*********************************************************************
*
* AgeChecck Type 1
*
*********************************************************************/
else if(driver.findElement(By.cssSelector("h2")).getText().equals(agecheckButton))
{
System.out.println("Achtung: Agecheck Button!");
driver.findElement(By.cssSelector("a.btn_grey_white_innerfade.btn_medium > span")).click();
if(driver.findElement(By.id("app_reviews_hash")).getText().contains(noReviews))
{
System.out.println("Keine Reviews vorhanden!");
continue;
}
else if(!driver.findElement(By.id("app_reviews_hash")).getText().contains(noReviews))
{
String all = driver.findElement(By.xpath("//div[#id='app_reviews_hash']/div[3]/div[2]/label"))
.getText();
String steamPurchaser = driver.findElement(By
.xpath("//div[#id='app_reviews_hash']/div[3]/div[2]/label[2]")).getText();
String communityURL = driver.findElement(By.cssSelector("a.btnv6_blue_hoverfade.btn_medium"))
.getAttribute("href");
}
}
/*********************************************************************
*
* No Agecheck
*
*********************************************************************/
else
{
if(driver.findElement(By.id("app_reviews_hash")).getText().contains(noReviews))
{
System.out.println("Keine Reviews vorhanden!");
continue;
}
else if(!driver.findElement(By.id("app_reviews_hash")).getText().contains(noReviews))
{
String all = driver.findElement(By.xpath("//div[#id='app_reviews_hash']/div[3]/div[2]/label"))
.getText();
String steamPurchaser = driver.findElement(By
.xpath("//div[#id='app_reviews_hash']/div[3]/div[2]/label[2]")).getText();
String communityURL = driver.findElement(By.cssSelector("a.btnv6_blue_hoverfade.btn_medium"))
.getAttribute("href");
}
}
}
catch(Throwable t)
{
System.out.println("Fehlermeldung aufgefangen");
t.printStackTrace();
}
}
private static boolean isElementPresent(WebDriver driver, By by)
{
try
{
driver.findElement(by);
return true;
}
catch(NoSuchElementException e)
{
return false;
}
}
}
I hope this will help people with a simular problem.

Remotely running automated test AutoitX cannot move the mouse or send keys

I have a weird specific question.
In my testing framework I have done the following:
1) Using Java and Ant/TestNG to run the tests.
2) Using Selenium to actually run the browser GUI Automation
3) Using AutoitX4Java to able to automate basic mouse movement clicks and send keys
4) Using Windows operating system.
5) Kick off the automated test with an "ant run" command. My build.xml file will compile the java source code and run the test.
So I am actually able to run my automation code successfully. When I am physically in front of my windows machine, and logged in as the local system user. I notice my Java test with AutoitX4Java can move the mouse around and click.
But the problem is when I use another Windows machine and remote connect in using "psexec" or since I have installed ssh on my windows machine, I ssh it runs the Java program and compiles it and runs the test. But it can't move the mouse around. It is almost as if AutoitX4Java just stopped working.
There are time pauses I notice when it runs those lines of code that requires AutoitX4Java. So I know it is doing something. Just appears to not be viewable on the screen (I cannot see mouse movements, right clicks, or send keystrokes) Despite everything else is still viewable (selenium web browser actions.)
I have a monitor that is connected to the physical machine, so I can view what is going on, when I remote in from the other machine.
Here is the Java code I used for the test:
package installFFExtension;
import java.lang.*;
import org.testng.annotations.Test;
import org.testng.annotations.*;
import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.SeleneseTestBase;
import com.thoughtworks.selenium.Selenium;
//imports for AutoIT
import autoitx4java.AutoItX;
import com.jacob.com.LibraryLoader;
import java.io.File;
public class firefox extends SeleneseTestBase {
public Selenium selenium;
#BeforeTest
public void beforeMethod() {
selenium = new DefaultSelenium("localhost", 4444, "firefox", "https://mytestsite.com");
selenium.start();
}
#Test
public void extensionInstallation(){
//this part initializes the AutoIT integration into this Selenium Java test
File file = new File("lib", "jacob-1.17-x86.dll"); //path to the jacob dll
System.setProperty(LibraryLoader.JACOB_DLL_PATH, file.getAbsolutePath());
AutoItX x = new AutoItX();
try{
//dashboard log in
selenium.windowMaximize();
selenium.open("/login/");
selenium.click("id=email");
selenium.type("id=email", "testuser");
selenium.type("id=pass", "testpassword");
selenium.click("id=submitInfo");
selenium.waitForPageToLoad("30000");
selenium.click("link=Install Page");
selenium.waitForPageToLoad("30000");
selenium.click("Install");
selenium.waitForPageToLoad("30000");
selenium.click("id=firefox");
// need to slow selenium to allow page load adding a sleep timer
Thread.sleep(1000);
x.mouseClick("left", 140, 408, 1, 15);
x.send("installer");
selenium.type("id=name", "installer");
x.mouseClick("left", 140, 469, 1, 15);
x.send("password");
selenium.type("id=password", "password");
selenium.click("Install");
x.mouseClick("left", 222, 372, 1, 15);//this was added to make install bar to go away in Firefox.
x.mouseClick("left", 150, 523, 1, 15);
}
catch(Exception e){
System.err.println("Exception Caught: "+e);
}
}
#AfterTest
public void afterMethod() {
selenium.stop();
// selenium.shutDownSeleniumServer();
}
}
AutoIT will only work when the browser is open on the same machine as the test is running.
AutoIT cannot be used when running distributed testing although I have heard claims otherwise using a compiled exe on the remote PC, it sounds complex and unstable.
The question may be is to investigate why you need to use AutoIT at all. What are you trying to achieve which cannot be done via Selenium? What are you trying to test?

Categories