Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There is trouble with understand how to start using RxDriver #2

Open
Grosha opened this issue Feb 14, 2020 · 1 comment
Open

There is trouble with understand how to start using RxDriver #2

Grosha opened this issue Feb 14, 2020 · 1 comment

Comments

@Grosha
Copy link

Grosha commented Feb 14, 2020

Hello, guys.

I try to use that driver but can't understand how.
So I added dependency for JavaFx (pom.xml) and all their modules and finally generated jar. So after that, I have a problem with start to use it. I have a web application that is written via JavaFx.
Could explain what should I do on that step?:

Run your application with option: -javaagent:/path/to/fxagent.jar

@1C-Company
Copy link
Owner

Hello.

This driver was designed for testing JavaFX desktop applications only.
So just add command line argument from readme when launching application.

For example:

  1. Create testapp.jar with application compiled from this code:
public class TestApp extends Application {
    public static void main(String[] args) {
        launch(args);
    }
    
    @Override
    public void start(Stage primaryStage) {
        primaryStage.setTitle("Test Application");
        Button btn = new Button();
        btn.setId("findme");
        btn.setText("button");
        
        StackPane root = new StackPane();
        root.getChildren().add(btn);
        primaryStage.setScene(new Scene(root, 320, 240));
        primaryStage.show();
    }
}
  1. Then run it using this command:
    java -javaagent:fxdriver-0.2-SNAPSHOT-shaded.jar -jar testapp.jar

  2. And this is simple unit test for test application:

RemoteWebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub/"),
        new DesiredCapabilities("javafx", "", Platform.ANY));
WebElement element = driver.findElementById("findme");
assertEquals("button", element.getText());

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants