How to automate testing <canvas> with Java [duplicate] - java

This question already has answers here:
How to perform Mouse Wheel scrolling over HTML5 Canvas in Selenium?
(2 answers)
How to click the center of the canvas in Java Selenium Driver?
(1 answer)
How to find the coordinates of the buttons on a canvas, and click on them after using Java and Selenium?
(2 answers)
Closed yesterday.
I'm doing UI automation with Selenide. I can't locate elements inside with regular way by xpath or css selector.
enter image description here
I'd like to find predictable and stable solution to make automation of on Java

Related

Set Java Swing Dock Icon on Mac [duplicate]

This question already has answers here:
Setting the default application icon image in Java swing on OS X
(6 answers)
How do you change the Dock Icon of a Java program?
(6 answers)
Change Java application icon?
(4 answers)
How can I change the default icon of a java application on a mac using netbeans?
(5 answers)
How do I set the icon for my application's Mac OS X app bundle?
(3 answers)
Closed 1 year ago.
I'm new to the Java Swing Package and I am trying to build a basic application. I want to change the dock icon on MacOS from the basic Java logo to my own and I tried using the code below but nothing changes. And this is the dock icons. I'm using MacOS 12.0.1 and Java SE 17.
var image = new ImageIcon("Content.png");
frame.setIconImage(image.getImage());
Can anyone help?

Is it possible to simulate a tap on an android screen? [duplicate]

This question already has an answer here:
How can I reliably simulate touch events on Android without root (like Automate and Tasker)?
(1 answer)
Closed 2 years ago.
Im working on an app, which would contain arrays which will have their intervals and I want to run the array so every interval, the app would run in the background and simulate a tap on the screen
Basically, the question is, if I can simulate the tap, and if yes, how
If you are running this as part of an instrumented test, that is very simple:
(need to add UiAutomator for this)
val device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
device.click(X,Y)
If you want to click on the screen during a normal app run:
check This SO question

How can I reset the preview window to the right of the screen? [duplicate]

This question already has answers here:
No "Docked Mode" option in "Preview" settings in Android Studio once undocked
(6 answers)
Closed 4 years ago.
Im not really sure about how my preview window ended up as a different window. I would like to restore it back to the left of the screen, like the default mode. I can't find the way to do it! Thank you!
Click the gear and click the 'Windowed Mode' again to disable it. It'll go back to the default position.

get running desktop apps with java? [duplicate]

This question already has answers here:
Windows running application list using Java
(4 answers)
Is there a Java library to access the native Windows API?
(6 answers)
Closed 4 years ago.
I´m trying to get the running programs with graphic interfaz that I have running and iterate over them to give them focus. Is there a way to do this with java (or any other language)?
Searching the web I only find things for Android. Any help is appreciated
Example: I have my calculator open, and my app made with javafx. My app shows me a list with all the programs running in my computer, in this example, it shows me that the calculator is open. There is a button next to each item of the list, and if I click on them, I can give the calculator focus and start using it.
You could use ps on the Linux and tasklist on the Windows. Java allows you the command line access.

Prevents screen snapshot [duplicate]

This question already has answers here:
How to prevent Screen Capture in Android
(16 answers)
Closed 4 years ago.
I have an Android banking app that prevents from taking a snapshot of the screen how do I do that in my own app.
Does anyone know how this is achieved?
It can be achieved by adding a simple code in the activity
if(android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
}
Just add FLAG_SECURE flag in the activity. It Works for all Android versions higher than HONEYCOMB ie API 11 or higher.
Window flag: treat the content of the window as secure, preventing it from appearing in screenshots or from being viewed on non-secure displays.
Thsi prevents screenrecording and screenshots

Categories