Toggle navigation
Log in
Sign Up
Log in
Sign Up
Appium
C
C#
C++
Docker
Go
Informatica
Java
JavaScript
Kafka
Numpy
Oracle
Pandas
PHP
Py Spark
Python
R
React Native
Scipy
SFTP
Tableau
Teradata
TGMC
UNIX
Forget_Code.Models.CategoryViewModel
Add a new snippet
Appium Basics
7
Color
1
Hello World
1
Screenshot
1
Tap
5
Choose Category
Appium - Get RGBA Color code of specific Point in UI in Appium
Forget Code
Appium
Appium - Get RGBA Color code of specific Point in UI
public static int getColor(int xCord, int yCord, String imagePath)
{
BufferedImage img = null;
File f = null;
f = new File(imagePath);
try {
img = ImageIO.read(f);
} catch (IOException e) {
e.printStackTrace();
}
int width = img.getWidth();
int height = img.getHeight();
int color = img.getRGB(x,y);
return color;
}
@SuppressWarnings("deprecation")
public static void validateColor(int xCord, int yCord, String imagePath)
{
int color = getColor(xCord, yCord, path);
//get alpha
int actualAlpha = (color>>24) & 0xff;
//get red
int actualRed = (color>>16) & 0xff;
//get green
int actualGreen = (color>>8) & 0xff;
//get blue
int actualBlue = color & 0xff;
}
Tags for Appium - Get RGBA Color code of specific Point in UI in Appium
DP_Color
Contribute to Forget Code, help others.
Add snippet