Locators in Selenium Ide - selenium-ide

I have just started to learn selenium ide and get to know that there are many locators such as ID, Name, CSS, Link, Xpath, DOM To find out the elements. What is the Best locator to find out the elements in a page?

Each locaters have pros & cons, better way to use according to your requirement. The following post will help you,
ID :- Pros - Each id is supposed to be unique so no chance of
matching several elements. Cons - Works well only on elements with
fixed ids and not generated ones
Name:- PROS: Works well with fixed list of similar elements CONS:
Difficult to use with data-bound lists.
Link:- PROS: Will only select anchor elements Useful when testing
navigation CONS: You have to know the text of the link before.
DOM:- PROS: Javascript allows you to build dynamic locators CONS:
Relies on the structure of the page
Xpath:- PROS: Allows very precise locators CONS: Slower than CSS.
Relies on browser?s XPath implementation which is not always complete
(especially on IE) and as such is not recommended for cross-browser
testing
Css:- PROS: Much faster than XPath. Widely used. Provides a good
balance between structure and attributes. Allows for selection of
elements by their surrounding context CONS: They tend to be more
complex and require a steeper learning curve

Related

Describing "greater than"-filters search in a REST API URL?

I'm designing a REST API where the /widgets endpoint can be filtered to only show widgets with a certain number of connections. This seems like a natural design:
/widgets?connections=4
I also want to allow filtering for widgets using lesser than and greater than, however. These URL designs seem wrong as they don't follow the classic query string pattern or appear misleading:
/widgets?connections>2
/widgets?connections=>2
What is the normal way of designing this kind of filter? I also need to be able to combine filters, e.g. "more than two connections and exactly one screen".
I've read this related question: REST URL design for greater than, less than operations, but it is not the same as it relates to pagination and ID, and does not contain a neat answer for combined filters.
REST does not give you an exact solution, it just says that your should use standards to build an uniform interface if there are available standards. If not, then it is up to you, anyways it must be documented for the client developers.
Here what you are doing is developing a complete query language for the URI. It would be good to check what exactly you need, because if there is a query language standard, then supporting it completely is just too much work. Afaik. Odata has something you need and there are other conventions, for example RQL is a very old one. With a little search there are other ones too: w x y z. I guess there are many others too. I would choose one of these and implement only what I need from it or look for an existing implementation.

Which CRDTs can be used to implement a full-featured collaborative rich text editor?

I have been studying CRDTs and understand that they have been used to build collaborative editors, including Ritzy, TreeDoc, WOOT and Logoot.
I'm interested in building such an editor, and need to know if CRDTs are known to be able to handle this problem in its generality.
To elaborate: A rich text document (think html) has a tree structure, but the nodes are heterogeneous. There are block elements, inline elements, tables, lists and so on. Further, there may be styles and stylesheets (e.g. css) embedded in a document. Finally, undo is essential.
The editors listed above do not handle the more advanced features, such as tables, embedded stylesheets and undo/redo.
The Ritzy documentation links to a paper describing CRDT-based causal trees (pdf) but I don't really understand this paper.
What is the basic principle behind a causal tree CRDT? Is it powerful enough to handle the heterogeneous trees described above? Alternatively, are there other CRDTs that could handle this scenario?
The implementation of a CRDT for rich-text is not very straight forward. Some CRDTs can be used to build trees. So the naive approach for rich-text would be to build it as a tree. A node would then represent a block of text with formats such as 'italic'. In order to format text, you usually have to delete it, and insert a new node with that format. But this does not always work as expected: For example, if two users concurrently format the same text, the formatted text is inserted two times after convergence (User1 deletes text, and inserts a new node. User2 deletes the same text, and inserts a new node). To my knowledge there are no CRDTs that solve this problem.
Actually a CRDT for linear structure does completely suffice. You can realize formats as markers (i.e. format start, and format end). This also has the advantage that you get the expected result when two users concurrently format/insert text.
For a working implementation of this approach you can check out Yjs. The examples section contains a working example of a rich text editor.
(Full disclosure: I am the author of Yjs)

Is There An Equivalent to EnsureDebugId() for Non-Widget Elements in GWT?

I'm currently writing automated tests for a GWT application using Selenium and Java. For page elements that are Widgets, this is relatively straightforward, given that unique IDs can be set using the ensureDebugIds() method.
However, some types on the pages I work with are not widgets, but other types, possibly container types (such as Cells or grid rows that are essential HTML tables). Is there a similar method to ensureDebugIds() for this? Or is there a way to create custom IDs for these elements that acts in a similar way compatible with ensureDebugId()?
You would need to closely collaborate with you dev team to set Id's on any element which GWT does not handle in its ensureDebugId. Its straightforward to id as all UIObjects have setId api. If any HTML code is being is injected then ids need to be determined by a simple convention and set up for Selenese test case writing to be easier.

Best Practice: Select by id or class with jQuery?

Assuming that every element in the DOM has its own unique class name:
Is it better practice to use IDs versus class names when selecting elements in the DOM with jQuery?
Are there any performance advantages when using one over the other in jQuery?
I've been told that traditionally getting a DOM element via ID instead of by class is much faster and usually better practice, but does that apply to jQuery as well?
Many thanks in advance!
jQuery just leverages browser functionality. On older browsers(IE<9), there is no getElementsByClassName function, but virtually every browser supports getElementById. On these browsers, jQuery has to traverse the whole tree and look for all elements with the given classname. Therefore, using IDs will be faster.
However, bear in mind that id's must be unique, i.e. you can't have two elements with the same ID. This is often not advisable, since components may be used in different contexts on the same page. Using IDs exclusively would prevent that.
Selecting by ID is still faster than by class-names in jquery.

Tools or programming libraries to visualize custom logic

I am looking for tools to aid in the visualization of custom business logic used to perform document generation. The logic is expressed as an object-oriented model consisting of a graph of decision points and rendering actions. The basic building blocks are relatively simple, but the overall decision tree is quite large and complex making it hard to visualize.
We are looking for suggestions on tools and/or graphing libraries that can be used to visually represent the decision tree and rendering actions. The choice of programming language is not critical (Delphi, C#, Java would be great) and we are able to easily extract the logic to XML or other data format as required. The preference is for something that will run under Windows and enable printing or PDF output of portions of the resulting diagram.
Requirements
Decision points can be simple yes/no or multiple outputs e.g. (yes, not, sometimes, always etc).
The decision points are linked to external business logic that exist elsewhere in the runtime environment. We need to label the graph node with the type of decision point (e.g. boolean) and string describing the business rule being used.
Rendering actions are linked to named content objects with optional merge variables and inline rendering logic. At a minimum we need to be able to label nodes with the name of the element and ideally also information about variables used to render the content.
We have considered building something around Visio or WinGraphViz, or perhaps using a third-party graphing/flowchart library. Any ideas or pointers would be greatly appreciated.
After some more digging I found WinGraphViz and DotXML to be the closest match to my requirements. I was previously unaware of the "record" element which allows me to render decisions in the logic flow in a clean and legible manner.
You can consider Morphir with the Elm frontend.
It is a solid tool for business logic modeling, and code generation.
Visualization is coming along as well.