Selenium IDE - Assert color of a test - css

I've been trying all the solutions i've found on StackO, but none of them works for me.
How would you verify that the backgound color is indeed blue for this element
css=#box10 > div:nth-child(3)
on this page https://www.w3schools.com/cssref/css_colors.asp
Thank you very much.

I have tried something but did not worked on Selenium IDE, but worked in Console:
You should get the color of the box with id="box10"
Return getComputedStyle(document.querySelector("#box10")).backgroundColor
You should take the string from the a.innerText inside the box with id="box10"
3.Compare the values
But here comes the catch:
assert on background.color with value ${box.color.a} Failed:
Actual value 'rgb(0, 0, 255)' did not match '#0000ff'
getComputedStyle(document.querySelector("#box10")).backgroundColor will return the rgb value
I have tried to convert it with the code found :
const rgb2hex = (rgb) => `#${rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/).slice(1).map(n => parseInt(n, 10).toString(16).padStart(2, '0')).join('')}`; rgb2hex(getComputedStyle(document.querySelector("#box10")).backgroundColor)
and it works in console, but it doesnt work on Selenium IDE Execute script command; I dont have much more time to investigate, but i hope is a good starting point. Let me know if you found something!
IDE:

Related

Multiple keys in sendKeys action

I'm trying to pass multiple keys Cmd Alt P at the same time to Dalek to test page behavior:
test
.open('themes/ribbon/index.html')
.sendKeys('body', '\uE03D\uE00A\u0050') // Cmd Alt P
.assert.attr('body', 'class', 'full')
.done();
And it seems doesn't work as test is failing. I'm using W3C WebDriver spec for key codes reference, but I haven't found clear description on how to send multiple keys (both in Dalek docs and spec), especially with regular, not special ones like Alt and Cmd.
The same test with just a F5 works fine, of course:
test
.open('themes/ribbon/index.html')
.sendKeys('body', '\uE035') // F5
.assert.attr('body', 'class', 'full')
.done();
After some test I came to the conclusion that this is related to a bug in DalekJS, could you please go over to Github and file an issue there?!
Thanks.

Multiple script/paperscripts in the same paperscope

I'm starting with paper.js. I like the fact that it introduces the possibility to have a script with a text/paperscript mime type, which runs in its on scope. However, scripts can become large pretty soon, so I want to be able to divide it in multiple scripts for readability. I thought I could just add more than one script tag and have them all run in the same scope, but apparently this isn't the case.
Both scripts are loaded and do run, but the second script doesn't seem to be in the paper scope.
I've set up an example here: http://barbata.nl/SO/Maps/ This example has some code, but I'll point out the important bits.
It contains two paperscripts:
Maps.js is the main script, which rasterizes the image and allows moving it around. You can ignore the code in this script, for it works fine so far.
Zoom.js is the script in which I wanted to isolate zooming functionality. It uses jq.mobi to capture the scroll wheel of the mouse, since Paper.js doesn't seem to have that event. It then translates that to a call to onMouseScroll, in a similar way Paper does it.
So far so good. The actual problem arises with the zoomIn and zoomOut functions in zoom.js.
It works if I explicity use the paper object to reference the view I want to zoom:
function zoomIn()
{
if (paper.view.zoom < 2)
{
paper.view.zoom = paper.view.zoom * 2;
}
}
But it fails when I remove paper and just reference the view:
function zoomIn()
{
if (view.zoom < 2)
{
view.zoom = view.zoom * 2;
}
}
This surprises me, as I expected the script to be a Paperscript, running in the Paperscope. It works fine if I put this code in Maps.js, so it seems that although zoom.js is loaded by Paper.js (the developer tools in the browser confirm this), it isn't run in the Paperscope.
My question is: are my findings correct? Am I doing something wrong? What is the right way to divide a Paper.js application into multiple units for readability?
Of course I can get it running, but I want to make sure I do it right.
This is indeed how it works. I've opened an issue on GitHub
I found that the "cleanest" way is to do it with this.install(window). It also makes error finding with Chrome developer tools easier since it is more adapted to reporting on the line errors in java-script than "paperscript".
in index.html (for example):
<script type="text/javascript" src='js/other_lib.js'></script>
<script type="text/paperscript" canvas="canvas">
this.install(window);
/*no code 'required' here */
</script>
<body>
<canvas id="canvas" width="1500" height="500"></canvas>
</body>
Then in the js/other_lib.js i just add code as normal:
var r = new Path.Rectangle([100,100],[200,200]);
r.fillColor = 'black';
/*more code here*/
This should generate a rectangle.
What DOES'T NOT WORK for me (as of Paper.js v0.10.2 Release Date: 9. July 2016) is the object operators. Such as adding vecrots pointc = pointa + pointb; for me this is giving a lot of NaN values.
I have had to edit a few libs to get this working, but the change is simple:
var pointc = new Point(pointa.x+pointb.x,pointa.y + pointb.y);

how change textcolor editor in qt

this is my syntax editor program i want to show keyword,classes,function and ...with Separate color i set the color in config file(with Qsetting)
for example this in my config file :
FunctionColor=blue
an in my cod i read the the configfile:
QString FunctionColor=settings.value("FunctionColor").toString();
how i can set the color in this instruction:
functionFormat.setForeground(Qt::FunctionColor);
compiler gives error? what i must be doing????
It would be great if you provide clear snippet codes instead of the example instructions above. However, based on my guess, if you check Qt documentation,
setForeground
is taking QBrush type of parameter. That means, to get what you want probably, you need to add some logic to convert between the string value to the QBrush value, for example:
if (FunctionColor == "blue")
{
functionFormat.setForeground(Qt::blue);
}
See if this could fix the problem.

Why is mix() not working with my colors in LESSC?

My less file piggy-backs on to the end of the Twitter Bootstrap files (so things like #white are defined already. Here is my less code:
#columnSortScreen: #99f;
// the color used
#columnSort: mix( #white, #columnSortScreen );
When compiled, I get the following error (everything underlined by carets is highlighted):
non_object_property_loadError: error evaluating function `mix`: Cannot read property 'value' of undefined in /Users/cmv/Sites/...../tablesorter.less:12:14
11 // the color used
12 #columnSort: mix( #white, #columnSortScreen );
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
What am I doing wrong? Lessc is version 1.3.0.
Thanks!
I had the exact same error.
Did some digging and found this:
The docs for mix are missing the third parameter.
Try:
#fallback-color: mix(#from-color, #to-color, 50%);
Note the third parameter. This solved it in my case, does this fix it for you?

Where is keywords code assist and letter not allowed problem(Aptana Studio 3)

I recently switched from Aptana2 to version3.0.3, and the first thing i did was to install the sdomcl. file to get jQuery code assist.It works fine for jQuery, but there is no code assist for many keywords.For exymple there is no support for var,while,throw,try,break,case,catch etc.
Also there is no function, instead intellisense sugests Function.
The second problem is that i am constantly getting this warning '<' + '/' +letter not allowed here when typing something valid like this:
confirmDiv =$("")-sorry for this,but it wont let me type what i want, basically i am just creating a new div with the correct syntax.
Could it be something with Html Tidy?Anyways, big thanks in advance!
Aptana Studio 3.0.4 includes code assist for JavaScript keywords.
I've read that for Javascript the slashes / must be escaped with backslashes \ as it says here
Doing so the warning dissapears ;)

Resources