what is the command for identifing the color of the object.
please help me ? my numberis 9916800532
Answer Posted / sayonita
e.g. You have a button colored. You want to get the color of the button. So the code will be:
WebElement ButtonColor=driver.findElement(r.getLocator("BtnColor")); //BtnColor is the element whose xpath I have mentioned in a properties file
String color=status.getCssValue("background-color"); //Captures the color and stores in a variable
System.out.println(color); //prints the color of the button
String hex = Color.fromString(color).asHex(); //convert this color code into hexadecimal format
System.out.println(hex); //print the color code and then you compare in your script
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How to get the Background color of a Tab or Button in TestComplete Tool using VBScript? I have a validation that to verify whether a particular tab or button is highlighted or not. When the tab or button is highlighted the background color will be in Yellow color.If i get the background color then its easy for us to validate whether its highlighted or not. Can anybody help me on this?. Thanks in Advance.
Generic function for selecting a Radio Button in a Dialog
When will you automate a test?
Explain me what is testng and why is it better than junit?
What do you think holds testers back to do automation? Is there a way to overcome it?
Tell us what you know about table-driven testing?
Explain me what is the difference between setspeed() and sleep() methods?
Do you know the difference between close and quit command?
What factors determine the effectiveness of automation testing?
What are the steps involved in the automation process ?
Tell us how can you create html test report from your test script?
What are the different types of scripting techniques for automation testing?
I am testing a GIS based application so Can anyone tell me which automation testing tool is best for this application?
can anyone suggest me any low cost tool that can support both Manual and Automation testing ?
Explain me what the webdriver supported mobile testing drivers do you know?