Selenium - Kendo UI Line Graph - selenium

I'm working on a Test Automation framework using Selenium and most of the testing is done on Kendo UI pages. One of the problems I'm having is the graph testing, there are two types of graphs on the page, bar chart and line graph. I have no trouble testing the bar chart, I simply get the < g > and < path > elements and find the one I need etc. But it's different with the line chart. Both < g > and < path > elements are generated when I hover over the graph, when the page loads the paths are simply not created. There's only a single object with all of the positions eg.
M57.295 40.425 L 59.885 40.425 62.475 40.425 65.066 40.425
... and a bunch of numbers after this. Unfortunately I cannot provide the URL to the website. Any suggestion is appreciated.

Related

Script to launch interactive session inside Spss Modeler

i want do interactive tree for my project. i'm writing code inside modeler syntax and this program to get me what i want(which i want Rots tree values) . Launch interactive session opens the tree builder, values is okey but i dont generated model inside scripting. i need just a click generated model icon (without manual) but this way manuel click. who know is this trick with coding or scripting?
i'm writing my code example;
import modeler.api
stream = modeler.script.stream()
res=[]
m1= stream.findByID('id68YV8NTPKIR')
m1.setPropertyValue("prune_tree", False)
m1.setPropertyValue("model_output_type", "InteractiveBuilder")
m1.setPropertyValue("tree_directives", """Grow Node Index 0 Children 1 2 Spliton (
"TotalCharges", Interval ( NegativeInfinity, 100) Interval ( 100, Infinity ))""")
m1.setPropertyValue("tree_directives", "Test")
m1.setPropertyValue("model_name", "Cart_Drug")
m1.run(res)
thanks.
There is no way to automate the generation of the model from an interactive session as these are by design intended to be interactive.
Can you provide some insight into why you are looking to automate an interactive session rather than just using the default of generating a model directly? Is there some specific feature that you are looking for that is not otherwise available?

Is there any way to test display order sequence of web elements in Selenium?

Problem Statement: I have web page with 4 carousels (say A, B, C, D). I need to verify their correct display order on the UI (and not in HTML code).
Few points to test:
A should be on top always and will be displayed every time.
B, C D should follow order : A > B > C > D (Making A appear always on top and D always last or on bottom)
The order should be as above even if any of the carousels are not displayed. (Like if C is not displayed the order should be A > B > D).
Any one/two/all of B, C, D may not be displayed on page.
Test should be able to identify the sequence on both desktop and mobile browsers.
Solution I tried:
Find all the elements and get their Y coordinates using getLocation().getY() in Selenium. Compare the Y coordinates and identify which one is at top.
Current issue:
The above solution only works for Desktop browsers, and not for mobile browsers like chrome for iOS or Android, as getLocation() always returns (0,0) for all web elements.
Similar question: Its not much related with my issue:
Can I test on the order of elements using Selenium Webdriver?
Other Details:
- I'm using Java 1.8 with Selenium 2.53
- All tests are executing on Browser Stack
How do I achieve this using Selenium Web Driver and JAVA?

PageSource() gets different code than appium inspector code

I am having a really hard time understanding the following problem, i have an app, i use appium inspector to see the elements, but when i use the elements, i get that the element is not found, therefore i printed the code using the driver.getPageSource() method, and i realized that the xml code that is created while running the app, is actually different to what appium inspector sees, what is the problem and how can it be solved? i could ask to the developers to fix it once i know the root cause, thanks in advance.
This is an example of a difference
Under < XCUIElementTypeOther name = Picture, Left Rear Corner> there are 4 more elements 2 StaticText, 2 Buttons (appium inspector) and on the the same element but in the java console, there are only 2 tags, so i do not see the 2 static text and the 2 buttons (which is what i want to click)
As you can see the code in the console is different to what i see in appium iinspector. this is for IOS app.
while (driver.findElementsById("Additional Videos").size() == 0) {
swipeScreenDown();
}
driver.getPageSource();
WebElement additionalVideos = driver.findElementByXPath("//XCUIElementTypeOther[#name=\"Picture, Left Front Corner\"]");
driver.getPageSource();
List<WebElement> idf = additionalVideos.findElements(By.className("XCUIElementTypeButton"));
driver.getPageSource();
System.out.println(idf.size());
driver.getPageSource();
idf.get(0).click();
driver.getPageSource();
Error got:
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
PageSource() action can print the visual elements at the screen.
As per my understanding, You are currently performing PageSource() action when loading the screen.
You need to click at the selected element
After click on this element use PageSource() action.
You get that element in the log of the PageSource().

What is the functioning of fireevent() in HP QTP / UFT?

I am learning HP UFT.
Recently I came across fireevent and I tried to implement it on the website of Flipkart. I was trying to use firevent("onmouseover") for the link Men on the homepage of the website.
I used ChildObjects to find out the Link and WebElement (in two different tests), first Highlighted it and then used object.fireevent("onmouseover") as well as object.fireevent("OnClick"). The OnClick is working and it is showing the link as selected (i.e. the dotted box covering the link when we press tab), but it is not showing the Menu Under Men Section.
I had googled and bingged a lot. But was unable to find the exact working of FireEvent in QTP/UFT.
Please Help me solving the above problem as well as some tutorials on FireEvent.
EDIT: I am using IE 11 for testing.
Motti has already answered the technical definition, but I shall attempt to give you a solution to your functional issue.
In my experience .FireEvent often doesn't work as you would expect. An alternative for something like onmouseover is to simulate user behaviour a bit more closely by actually moving the mouse to the desired location. In our framework we have a little extension function to do just that, a pared-down version of which is shown here:
Sub My_MouseOver(objSender)
Dim absX : absX = objSender.GetROProperty("abs_x")
Dim absY : absY = objSender.GetROProperty("abs_y")
Dim width : width = objSender.GetROProperty("width")
Dim height : height = objSender.GetROProperty("height")
Dim x : x = (absX + (width / 2))
Dim y : y = (absY + (height / 2))
Dim deviceReplay : Set deviceReplay = CreateObject("Mercury.DeviceReplay")
deviceReplay.MouseMove x, y
Reporter.ReportEvent micDone, "A step name", "A useful step description"
End Sub
RegisterUserFunc "Link", "MouseOver", "My_MouseOver"
RegisterUserFunc "WebButton", "MouseOver", "My_MouseOver"
RegisterUserFunc "WebElement", "MouseOver", "My_MouseOver"
As an example you can then do as follows to bring up the "ELECTRONICS" menu overlay on flipkart.com (obviously substitute your own Browser and Page definitions):
Browser("Flipkart").Page("Main Nav").Link("xpath:=//a[#data-tracking-id='electronics']").MouseOver
In the original version there's various extra bits of error handling and custom reporting so it tells you what you clicked on, but the essence is the same. It locates the object on screen, calculates the centre and moves the mouse there. You might want to wait a small amount of time for the menu overlay to appear after doing so before calling .Click on one of the newly-displayed sub-elements.
I found a solution to my problem and it is working perfectly.
Setting.WebPackage("ReplayType") = 2
object.FireEvent "onmouseover"
Setting.WebPackage("ReplayType") = 1
In this case, the object will be:
Browser("name:=Online Shopping.*").Page("name:=Online Shopping.*").Link("innertext:=Men")
I have tried this and it is working fine. I guess, we do not need any alternatives. But I really don't know is, Ctrl+Space is not working for this in UFT. Don't know the reason.
This actually depends on what browser you're using.
Warning: There are exceptions to the information presented in this answer and it also may change in the future. The answer is meant to give a basic understanding but don't depend on it to be true without checking the behaviour for your specific version/use-case.
Originally QTP's FireEvent was supposed to call IE's non-standard fireEvent method.
On Firefox and Chrome this is implemented using the standard dispatchEvent. You should check which events the web site expects to get.
Things get complicated if you mix the event models (the standard DOM level 2 and Microsofts) as explained in this blog post.

How to measure the position of an element in web page using selenium RC?

I have tried a lot in finding out how measure the coordinate of an element in a web page in different browser.But I could not find any solution.
Is there any other tool that can measure the position of an element in various browsers???
In AutoIt you can use the following code to get screen coordinates (in my example for displaying a tool tip as an overlay on an Internet Explorer):
$oIE = _IECreate("http://...URL...")
$username = _IEFormElementGetObjByName(_IEFormGetObjByName($oIE, "loginform"), "username")
ToolTip("Login", _IEPropertyGet($username, "screenx"), _IEPropertyGet($username, "screeny"))
_IEAction($username, "focus")
Alternatively you can use _IEGetObjById($oIE, "mx77") to get an object reference. Or run through all all elemnts by tag name as shown here.
Instead of getting the absolute screen position, you can get the In-Browser-Position, using
browserx and browsery.