Show div at node position - cytoscape.js

I try to show a div at the node position when the node is clicked, but it does not seem to work; I found the properties position and renderedPosition of the event object, I believed that I could use them to set the position properties of the div, but with no success. What am I doing wrong ?
here the fiddle: https://jsfiddle.net/m8wzcjqn/1/

Related

VBA macro how to click on button on website on chrome, using Selenium

I am trying to program to click on one button on website on chrome. The name of the button is "Add to Cart".
Please see HTML of the website:
enter image description here
And this is the VBA code:
CD.FindElementByCss("div.addToCartButtons clearAfter > button blue right s-addToCart > span.Add to Cart").Click
How can I do this?
Tags are important, you can anticipate some of the events attached to certain element in DOM just by reading its tag.
In your case you can click on the button tag directly instead of clicking the tag span, since this last one rarely has a .click event attached to it.
If you can provide an url to test this website I might help you better. This are the possible approaches:
1) Advanced:
a. Spaces in class are change for dots
b. Requires to understand tag's meaning and relative position of elements in DOM
'Example
'Clicking first button in div using only tag ("button" is a tag)
CD.FindElementByCss("div.addToCartButtons.clearAfter > button").Click
2) Intermedium:
a. Use only first Class and ignore all others after first space
b. Requires to understand what an elemment.child is
'Example:
'Clicking first child of "div" (Everything inside "div" is a child)
CD.FindElementByCss("div.addToCartButtons > button:nth-child(1)").Click
3) Easiest:
a. Double quotes ["] inside querySelector are changed to single quote [']
b. Requires to use Copy JS path in DevTools (Ctrl + Shif + I)
'Example:
'Clicking with Javascript in your website through ExecuteScript
strTemp = "document.querySelector('div.addToCartButtons clearAfter > button blue right s-addToCart').click"
CD.ExecuteScript (strTemp)

When centring a label it goes behind a panel

I'm using the code:
Label1.Left = (Me.ClientSize.Width / 2) - (Label1.Width / 2)
to center the label, but it seems to hide behind panel1 when I center it, it does not disappear behind it when not centering it.
I have right-clicked the panel and sent to back but that doesn't seem to do anything.
Thanks
Use Anchor property for centering the label.
In designer:
Remove all anchors, by default Top and Left anchors are enabled
In code:
Label1.Anchor = AnchorStyles.None
Enabled anchors keep selected distance to the parent boundaries same when parent size is changed.
When opposite anchors are disabled distance to parent's corresponding boundaries will be kept even.

Textbox scroll to bottom in Avalonia

I have a textbox that I write info to that automatically creates a scroll bar when the screen is filled, and I'd like to scroll to the bottom of it. It seems like what I need to do is set the scrollbar Offset to some vector, but my problem is finding the ScrollViewer.
I can't use FindControl because it's not named anywhere in the xaml, and I can only change a few values using textbox.SetValue
The only way to scroll a TextBox currently is to set the CaretPosition. For example to scroll to the end of the text you could use:
textbox.CaretIndex = int.MaxValue;
For me it works only when I set textbox.CaretIndex to the length of the text. Assuming that property Logs (string type) is binded to textbox I used this
textbox.CaretIndex = Logs.Length

Tosca: How to scan Dropdown textbox which disapper upon opening xScan

I have a problem in scanning a drop-down menu which disappears upon opening the xScan. I need to get the module id of the dropdown menu to verify some test steps.
Do you have any solution with this if it is not really possible to get the module id of the dropdown menu?
Open developer tools in your browser of choice (F12), navigate to the console and input the following code:
var fulldoc='';
var scrollX=0;
var scrollY=0;
document.addEventListener("keydown",function(event){
if(event.key=='q' && event.altKey){
fulldoc=document.body.outerHTML;
scrollY=window.pageYOffset;
scrollX=window.pageXOffset;
}
if(event.key=='w' && event.altKey){
document.body.outerHTML=fulldoc;
document.body.scrollTo(scrollX,scrollY);
}
});
When the window looks the way you would want to scan, press 'Alt + Q', then press 'Alt + W'.
Now your window will freeze and then you can scan your page.
To steer the objects you need to refresh your browser.
You can resolve the issue with below 2 steps
1 - Add some text in textbox which will populate the dropdown below it .
2 - Use Send Keys Module to scroll down and select the value.
I had a similar issue where we had a popup that only appeared when clicking on a text box. The solution we received from the Tricentis trainer was as follows:
Part One
1. Open your application in Chrome
2. Right click the inspect
3. In the inspector window, on the Elements tab, navigate to your html element where it should be (you can do that by clicking on the element and check that you can see the html in the element)
4. Use the debugger to add a break point there, this should pause it and you should be able to see the elements you need to steer it.
5. Once you found the element, you will need the type of element (e.g. div, span, etc), and the class name
Part two
1. Rescan your module and select any element that matches the criteria of your element selected in Part One #5
2. Identify it by only it's class name property and tag
3. Save and close
4. Edit the element in the module view by changing the class name. This should help you steer it
Note: if the element class name is not unique, you might need to use Explicit name.
Good luck

Dojo get next sibling based on current event target

I have this dropdown menu, and all i want to do is upon firing the onmouseenter event, to change the border-left of the targets next sibling to white. So far i can address the currentTarget's border-left with ease, but i cant find a way to do the same for the next sibling. Any ideas ?
please try this
dojo.query(evt.currentTarget).next()[0]
The DOM node attribute nextSibling can be used to get the next sibling. See https://developer.mozilla.org/En/DOM/Node.nextSibling.
If you want to apply some filtering when getting next sibling, e.g. get the next sibling with a certain CSS class name, try to use dojo.query. For example,
dojo.query(node).siblings(".myClass")
returns a node list of siblings of node with class name myClass.