Run given process from Terminal using Robot Framework

Problem:- How to execute external files (say test.py) as process using robot framework?

Solution:-

Approach 1 :- Using Run Process keyword, under “Process” library

Step1:- Include “Process” library in settings

Process library in robot framework


Step2:- Use “Run Process” keyword as below

Comment Using Run Process Keyword
${result} = Run Process python -c print 'Hello, world!'
Should Be Equal ${result.stdout} Hello, world!
Comment Using Run Keyword
${output} Run python ${EXECDIR}/Resources/Lib/data-generator/mqttgen.py 10 10 10


Approach 2 :- Using “Run” keyword under “Operating System” library

Step1:- Include “OperatingSystem” library in settings
Step2:- Use “Run” process keyword.

Example below we used our test data generator(third party .py file) to be triggered by Robot framework/

Run process example in robot framework



Learn Robot Framework

Basic/Simple Selectors

type selectors




Type /Element Selectors: The most common and easy to understand selectors are type selectors. Type selectors will select any HTML element on a page that matches the selector or node name regardless of their position in the document tree . Used alone, therefor selects all the elements for the given node name.

Syntax

element selectors


Example: View in JSFIDDLE

type selector

There is a huge list of HTML elements that you can select using type selectors which means you can change the look and feel of any element in the DOM.


Class Selectors: These selectors select HTML elements based on the class attribute regardless of their position in the DOM. The class is defined as space-separated list of items and one of those items must match exactly the class name given in the selector.

Syntax

Class Selectors





Example: View in JSFIDDLE

class-selector

Some key points to remember while using Class Selectors:

  1. Classes should not replace HTML elements
  2. Don’t overuse classes
Think about the following two important points before using a class selector: 

  1. Is there an existing HTML element that could be used instead?
  2. Is there a class or ID in the DOM that could be used?
ID Selectors: ID selectors are similar to class selectors. These selectors select the HTML element which has an ID attribute.

Syntax

ID selectors





The major difference is that ID’s can only be applied once per page, while classes can be used as many times as needed.



Universal Selectors: In CSS , * (asterisk) is the universal selector. It is like a type selector which can match any type of HTML element.

It can be used in a universal reset like this:

universal selectors


In CSS 3 , the asterisk can be used in combination with namespaces

  1. ns|E: elements with name E in namespace ns
  2. *|E:   elements with name E in any namespace, including those without any declared namespace
  3. |E:   elements with name E without any declared namespace
  4. E :   if no default namespace has been specified, this is equivalent to *|E. Otherwise it is equivalent to ns|E where ns is the default namespace.
Attribute Selectors: An attribute is a property of an element which can contain values. These selectors picks out nodes based on the value of one of its attributes. 

In the following code segment, text highlighted in red are attributes and the text highlighted in green are attribute values.

attribute selectors


Group id vs Artifact id for a project

Problem:- 
When creating a new project in java IDE, what is the significane of group id and artifact id?

group id intellij


Solution:-
Lets understand what are these values and why we use them.

What?
Group ID :- Its an value which gives unique name to the project (like primary key in SQL tables).

Artifact ID:- Name of the project (jar file will have the same name, when project is build).

Conventions?
Group ID :- Like package in java, it follows the reverse domain naming approach.
Confused ???, lets have a example.

Lets say we have domain as www.ufthelp.com than group id will be com.ufthelp(reverse of domain)
another example, www.google.ca, will be ca.google.

Artifact id:- Its the name of the project (lowercase and longer name seperated by dash).
Example, selenium2library

Note:- 
Version, is the build version of the project, i.e jarname.version example chrome-53.1 (where chrome is the name of thee project, 53.1 is version)

Read more
Learn Java
Learn Selenium

CSS Selectors

What is CSS ? 
CSS (Cascading Style Sheets) is a language that controls the look and feel of html elements in browser. 

Layman example:- Going to beauty salon for hair cut is applying CSS on our face (which is equivalent to HTML). 

css selector comparison with hair cut


What is the meaning of CSS selector? 
Selectors are used to apply CSS styles on html elements. There is an extensive list of CSS selectors available, allowing for close grained precision when targeting elements to style. 

Layman example:- there are numerous types of hair cuts(styles) and various tools to cut hair (CSS selectors). 

How many types of Selectors? 

Selector Types


Selectors can be divided into the following categories: 
Basic/Simple selectors: Match one or more elements based on element type, class, id or attribute/attribute values. 

Pseudo-classes: Match one or more elements that exist in a certain state, such as an element that is being hovered over by the mouse pointer, or a checkbox that is currently disabled or checked, or an element that is the first child of its parent in the DOM tree. 

Pseudo-elements: Match one or more parts of content that are in a certain position in relation to an element, for example the first word of each paragraph, or generated content appearing just before an element. 

Combinations or Group Selectors: These are not exactly selectors themselves, but ways of combining two or more selectors in useful ways for very specific selections. So for example, you could select only paragraphs that are direct descendants of divs, or paragraphs that come directly after headings. 

Multiple selectors: Again, these are not separate selectors; the idea is that you can put multiple selectors on the same CSS rule, separated by commas, to apply a single set of definitions to all the elements selected by those selectors. 

We will be covering all these selectors in detail in the upcoming posts.

CSS positioning??