How do I zoom out of a specific webpage when using Nightwatch.js? - selenium

I am trying to zoom out of my current webpage (not just the css elements) using Nightwatch. I have been trying to use the .keys() method that is already provided in the framework by using
browser.keys([browser.Keys.CONTROL, browser.Keys.SUBTRACT])
and
browser.keys([browser.Keys.CONTROL, browser.Keys.SUBTRACT], browser.Keys.NULL)
as well as
broswer.keys('\ue009', '\ue027')
but nothing seems to be zooming out properly. Am I using the correct syntax or is there another way to zoom out using the keys? Thank you for your help

Instead of:
browser.keys([browser.Keys.CONTROL, browser.Keys.SUBTRACT], browser.Keys.NULL)
try this:
browser.keys([browser.Keys.CONTROL, "browser.Keys.SUBTRACT", browser.Keys.NULL]);

If the above solution doesn't work for someone, you can do this:
browser.execute("document.body.style.zoom='50%'");

Related

wxGrid - RefreshBlock Undocumented Member Function

In order to refresh a part of the grid, i.e., when font or alignment changes, I was using the following approach:
wxRect rect1=CellToRect(TopLeft);
wxRect rect2=CellToRect(BottomRight);
wxRect r(rect1.GetTopLeft(), rect2.GetBottomRight());
RefreshRect(r);
This was refreshing only a part of the intended block and was not working correctly.
From the suggestions of intellisense I came across RefreshBlock function and it works correctly. I searched the docs and have not found any information on it. I wonder if it is not recommended to use RefreshBlock for some reason? What does RefreshBlock do, does it refresh a block (as the name suggests) or is it equivalent to Refresh?
I am using wxWidgets 3.2 on Win10.
Thanks in advance.
The function RefreshBlock() is indeed the best way to do what you want and it was only undocumented by mistake, i.e. we simply forgot to do it. I've added documentation for it only now, so it will only get included in 3.2.1, but you can still use it in your code, the function itself is available since 3.1.3.
It seems from the source code that, depending on the location of its parameters, RefreshBlock refreshes any of the following:
corner grid
frozen cols grid
frozen rows grid
main grid
Since the area I wanted to refresh was on the main grid the following approach works (the idea is similar to RefreshBlock's approach):
auto GridWnd = CellToGridWindow(TL);
wxRect rect = BlockToDeviceRect(TL, BR, GridWnd);
GetGridWindow()->RefreshRect(rect);
Now everything is refreshed correctly.
Notes:
If only RefreshRect(rect) is called, things will NOT work as expected.
Little experiment showed that BlockToDeviceRect(TL, BR) also works, therefore eliminating the need for auto GridWnd = CellToGridWindow(TL);

Fancytree Tooltip API

I have been using Fancytree quite successfully for several years. Of late a new requirement has arisen. I would like to change the tooltip for a node that is currently visible. Is there a way to do this? How? Using an API? I have tried changing the tooltip property of an existing Fancytree node. Strangely, this did not work. What will work? Thank you.
Over on Github, this was resolved by Mr. Wendt. He suggested calling node.renderTitle() after modifying node.tooltip (which was correct) and he found a typo in my code. See Github issue #1093

How to resize the element using jsPlumb?

In my application I need to resize the elements. Here I found the perfect example
[http://jsfiddle.net/sporritt/HUKMC/9/][1]
but its not working in my code.
Even when I used the same code without changing it, it didn't work for me.
Any help?
Thank you!
Without posting your code it is difficult to debug. Make sure that the object which is resizable is set with below class:
$('#resizable').addClass('ui-widget-content');

How to get raw mouse events with XI2 extension?

I'm using XISelectEvents for root window with deviceid=XIAllDevices and mask=XI_RawMotion, but I don't get any events. What's wrong?
While looking through the header files, I noticed that there is XI_RawMotion and XI_RawMotionMask. Does the later fix your problem?

How can I get <asp:menu> working in Safari?

On the safari browser, the standard <asp:Menu> doesn't render well at all. How can this be fixed?
Thanks for the advice, it led me into the following solution;
I created a file named "safari.browser" and placed it in the App_Browsers directory. The content of this file is shown below;
<browsers>
<browser refID="safari1plus">
<controlAdapters>
<adapter controlType="System.Web.UI.WebControls.Menu" adapterType="" />
</controlAdapters>
</browser>
</browsers>
As I understand it, this tells ASP.NET not to use the adaptor it would normally use to render the control content and instead use uplevel rendering.
You can use ControlAdapters to alter the rendering of server controls.
Here's an example:
http://www.pluralsight.com/community/blogs/fritz/archive/2007/03/27/46598.aspx
Though, in my opinion it might be equal amount of work to abandon the menu control for a pure css one (available on many sites).
Oooof - was hoping it would be a simmple case of adding a browserCaps item in web.config with appropriate values or similar...
The best and simplest solution I've found for this problem is to include this bit of code in your page_load event.
if (Request.UserAgent.IndexOf("AppleWebKit") > 0)
Request.Browser.Adapters.Clear();