Sikuli, Java & Selenium - How to detect image background colour change? - sikuli

Looking at Sikuli (in conjunction with Selenium) as a possibility for automating the more visual elements of our UI testing, in particular issues that may crop up when the expected branding is not applied.
In my test, I have a white navigation icon image sat on a purple nav bar. I take a screen grab of the white icon sat on it's purple background and that is used as my Pattern in the Sikuli test class. If I then change the CSS in my web app so the nav bar is red, I want the test to fail.
Unfortunately, the background colour change is ignored and the icon is clicked regardless. If I set the pattern's similarity value to 1f (i.e. an exact match), the icon is not clicked. However, it also does not clicked the icon if I change the nav bar colour to the correct purple so it matches the icon screenshot I am using for the pattern.
A "similar" parameter value of anything from 0 to 0.9 lets the test pass once again, regardless of the nav bar colour.
Is this a restriction in the ability of Sikuli or am I missing something?
Edit:
So I found THIS ANSWER to a similar question and it prompted me to check the score returned when trying to match the white icon on red pattern and the white icon on purple pattern to the web page which had the purple branding. The score for both was over 0.9, with the difference from about the second decimal place onward, hence the match of both when I set the "similar" property of the pattern to 0.9.
It prompted me to try increasing the area of the screen shot to include more background relative to the icon size. This resulted in a score of 0.9x for the white on purple pattern and 0.7x for the white on red pattern.
So my conclusion is that the matching does take account of the background colour but if the majority of the screenshot pattern you are using is the same colour, the difference in score is minute.

Can you bypass the background directly behind the icon and look to the side of it? Excuse my lack of coding knowledge just trying to help come up up with a work-around
exists (icon):
if exists(whitebg): #capture a small area with just the color near the icon
pass
if exists(redbg):
fail

Related

Stripes in background in RDL

Is it possible to add stripes in the textbox in report?
So the result looks like in the picture?
User chooses color for the column in the application
color
This is no built in way of doing this (no fill style) but you could use an image of the stripes as a background image. You would need to create and save images for each colour and style and add them as embedded images in the report.
You can then set the background image of a textbox to the required image.
... or better still use an expression to select the image based on conditions.
=SWITCH(
Fields!ItemCode.Value >10 , "RedStripe",
Fields!ItemCode.Value >50 , "GreenStripe",
True, Nothing
)
Where Redstripe and GreenStripe are the image names you embedded.
You can set the image to repeat etc from the properties panel
Update after OP stated that colour is parameterised.
If the colour is a parameter then we need a slightly different approach.
First you need to create an image with stripes (any colour will do ), and then remove the stripe pixels so that the stipes are now transparent. Save this as a PNG.
I created one quickly whist testing which you can save from here hopefully. You'll just have to move the mouse around in the area below as it's a white on white image! Or switch StackOverflow to the dark theme, then you can right-click and save the image. If not you'll just have to create one yourself.
Image below here.. switch StackOverflow to Dark theme to see it
Image above here..
Now you will need to set the background image to this image but also set the backgroundcolor property to an expression. In this exmaple, I set the background to the value of my parameter.
My parameter is just text and I typed in some hex values in the form #FFFFFF. You will have to work out how to get the value from your color pickers to the report yourself, ask a new question if required.
Here's the report design
and here is the report running using a few sample hex values.

apple-mobile-web-app-status-bar-style in ios 10

I know this question has been asked previously, just want to know if this is still the case in ios 10 (and ios 9)...
According to the apple developer guidelines for web apps (found here), there are 3 choices for the status bar in a web app; default, black and black-translucent.
Default results in a white status bar with black text,
Black results in a black status bar with white text, and
Black-translucent results in a transparent background with white
text. Additionally, this status bar floats above your content,
meaning you have to push your content down 20px in order to not have
the content overlap with thte status bar text.
I'd really like to use the black-translucent status bar (as I think it looks more native), but the background of my page is a light grey. This makes the white text on this status bar very hard to read.
Put simply, I'd just like a transparent background with black text (essentially, default-translucent). Is this possible?
Unfortunately, No you cannot have black text on a transparent background.
I'm of the opinion that this will be added to the schema at some point and also find it a pain that you can't achieve this example right now. I guess in short the answer is design your faux app natively to achieve greater control of its behaviour and appearance.
Apple Documentation Supported Meta Tags
content="default"
content="black"
content="black-translucent"
I found the solution! We can achieve that with theme-color meta tag.
<meta name="theme-color" content="#fff">
It currently isn't possible. I just wanted to add (after reading a comment) that in order for the changes to show up, at least on my iphone X, you will need to delete the app from your phone then re-add it to the home screen.

How to remove yellow dots gif

i need remove all the yellow dots.
I removed white background in photoshop and save it for web and they are still here, if I set a black background in browser.
the same effect happend if I add new layer in photoshop ...
screen from photoshop
You can do it pretty easily with ImageMagick which is installed on most Linux distros and is also available for OSX and Windows. Just in the Terminal window at the command-line:
convert globe.png -fuzz 10% -fill gray -opaque "rgb(232,235,144)" result.png
That says... "open "globe.png" and find any pixels that are within 10% of rgb(232,235,144) and fill them with mid-grey, saving the result as "result.png"
Of course, you can fill the dots with another colour by changing the word gray to pink or any other rgb() colour you like!
GIF has indexed colors. If you use the classic dialogue save for web. You can manually assign a color to a table indexed color. Like this: http://sklad.bereza.cz/00-jarda/00_screenshot/2016-06-18_174624.jpg
The problem is that the GIF has a limited number of colors and some colors consists from several different colors. By assigning a color to a table you stop composing and is used direct color.

Identify color hex codes in a straight line

How can I programmatically ascertain the html color hex codes for colors in a single spectral line? I'm definitely using the wrong terminology I'm just not sure how else to phrase it. This picture should bring clarity:
Notice how the cursor in the top rectangle is always in the same position. It's simply the cursor in the first bar that moves into different color segments, thus generating the hex codes visible below.
Is it possible to generate these programmatically?
it would take 3 steps to get there programatically:
choose the base color (for each of your screen shots its the right top corner)
then lighten it to the the right amount (the X axis of your squares)
then darken it to the right amount (the Y axis of your squares)
if your'e using precompiled css like SASS it would look like that:
$someColor: red;
$lighten: brighten($someColor,20%);
$darkenedColor : darken($lighten, 32%);
$darkenedColor will get you the point that you are looking for, it will work for any given $someColor

Can you change the default color for selected text in MS Access?

I haven't found an existing post about this so I'll give it a shot.
I'd like to know if there is a way to change the default highlight color for selected text? Right now, whenever I invoke .SetFocus on a field, Access "selects" the contents of the field. The color it uses is black, and makes the data very hard to see. Is there a way to change that color?
Access simply swaps the background and foreground color as its means of highlighting text in a text box. As far as I know there is no way to change this behavior.
Obviously you can change the foreground and background colors themselves, but there is no separate "highlight" color that you can set independent of the foreground/background.
Although this isn't specificity for List Boxes I still think it is worth a note that List Boxes work slightly different (not sure why... maybe a different developer!) the selected row on a list box will inverts the colour of the background and foreground separately instead of swapping them.
For example if you had a light blue text on a white background normally the selected row would be a red text on a black background. The white inverts to black and the light blue inverts to red.
Or if you had
Not sure which method I like better but it would be nice if they where the same! Makes UI's look a lot better when they are consistent throughout the form!
Sometimes this problem can be caused by using a transparent text box on a background that is the same or similar color (with contrasting-colored text). Make sure you have the text box back color set to a same/similar color as the background.
Basically, you need the text box back color to contrast with the text. When highlighted, the highlight will be a contrasting color to the text box background color.