unable to upload image when run my code in github actions - java

I need to upload an image using selenium webdriver and run it locally and on GitHub actions using java language :
I added the image in the folder in my project
get absolute path to my image
used sendKeys() to send the absolute path of my image
when running code locally works fine but when running it on GitHub Action returns an error "org.openqa.selenium.InvalidArgumentException:"
File file = new File("src/main/resources/UploadImage/MyImage.png");
imageUploadChooseFile.sendKeys(file.getAbsolutePath());
Screenshot for the error :
Screenshot for the error

Related

Difficulty in retrieving Image with URL in a Java .JAR

I'm attempting to retrieve an image for a Java Swing icon. I followed some advice here on SO to use URLs to retrieve it from a jar, but I am getting a null URL:
URL iconUrl = this.getClass().getResource("/buildings/"+buildingEnum.getColor().toString()+".png");
Toolkit tk = this.getToolkit();
Image img = tk.getImage(iconUrl);
My .JAR structure looks like this. I built it using Gradle and ShadowJar.
Both running it through IntelliJ and as an actual .jar in Powershell failed to retrieve it properly.
Is there something I'm missing? Please let me know if there's any additional information I need to provide.

JavaFX CSS image loading on Linux

I would like to load an image as a background image in a css file included by my fxml file.
I am certain that the CSS is working, because I can change the background color for instance, but when I try :
GridPane{
-fx-background-image: url('wallpaper.jpg');
}
I always end up with this warning :
WARNING: Error loading image: file:/home/user/IdeaProjects/btnv2/ws_client/out/production/ws_client/wallpaper.jpg
Now the weird thing is that the image path displayed by the error is correct, and when my friend pulled the project the image displayed correctly for him with no error.
I am running Arch Linux and he's on MacOs, i figured that might have something to do with it.
This is the production project structure :

Uploading Image using ChromeDriver on Android

I'm trying to upload a image in Android using ChromeDriver.
so at first, i used sendKeys(IMG_PATH_ON_PC); to input but it wasn't worked.
console says
Failed to load resource: net::ERR_ACCESS_DENIED
and then i tried to upload it from my device.
i pushed an image via adb to /sdcard/imgtoupload.png
and used sendKeys('/sdcard/imgtoupload.png'); but it doesn't work either.
ChromeDriver says it's not an Absolute Path.
what do i need to do?
I found it.
use //mnt/sdcard instead of /sdcard

Unable to capture image data using Windows Biometric Framework

I am developing a Biometric module using WBF. I am using the code given at Winbio CaptureSampleImage to get image data which is converted to a .bmp file and saved. I created a DLL file containing all the code related to my work with WBF. I am using this DLL in a Java Spring Boot Application using JNI. The jar created by this is run via a .vbs file as given below.
Set shellObj = CreateObject("Shell.Application")
shellObj.ShellExecute "C:\Program Files\Java\jre1.8.0_192\bin\java.exe", "-jar MyApp.jar", "", "runas", 0
"runas" is used to run jar as Administrator rights. "0" is used to set it invisible.
I have previously used the DLL in a Jar running as a service using WINSW. For this I included WinBio AcquireFocus after creating a session as mentioned in WinBio AcquireFocus and Winbio CaptureSampleImage and it works perfectly fine.
Now I have two scenerios.
1) I use the code provided in Winbio CaptureSampleImage. This approach gets stuck when following is called.
hr = WinBioCaptureSample(
sessionHandle,
WINBIO_NO_PURPOSE_AVAILABLE,
WINBIO_DATA_FLAG_RAW,
&unitId,
&sample,
&sampleSize,
&rejectDetail
);
that is no output is returned.
2) I use WinBio AcquireFocus like I did with my service.
This prompts error:
Code : 0x80070005 (Access Denied).
Common HRESULT values are given HERE. This is probably because AcquireFocus can not be used in Application such as mine.

i am not able to view my downloaded file in downloads folder using selenium java

[Screenshot displaying the downloaded file in a window[][1]1i am not able to access my downloaded file which i opened in a new small window popup using selenium java and also i am not able to find it in downloads folder.
When i click on a download button-->the file gets downloaded with an icon of word in a new small popup browser window-->but it does not move into the downloads folder. Testcase passes but i am not able to validate.In that browser window i am not able to find any elements....only .... tags are displayed.. While doing it in manual way i am able to view it in downloads folder.
Kindly advise me what should be done.
you are coding in java language,
so, use method exists() which will return boolean value.
You must know your Downloaded file name along with exact download path,
String FileName = "YOUR_FILE_NAME";
File tmpDir = new File("C:\Users\a.k\Downloads\"+FileName);
if(tmpDir.exists())
System.out.println("File Downloaded");
System.out.println("File Not Downloaded");

Categories

Resources