Skip to content

Instantly share code, notes, and snippets.

View 007bsd's full-sized avatar

Bhabani Sankar Das 007bsd

View GitHub Profile
@007bsd
007bsd / datepicker.robot
Created December 22, 2017 09:06
Auto date Picker
```*** Settings ***
Library Selenium2Library
Library DateTime
Library month_dates.py
Library String
*** Variables ***
${November} 30
${y} 1
@007bsd
007bsd / parse.py
Created December 22, 2017 08:20
parsing robot xml
from robot.api import ExecutionResult, ResultVisitor
def _parse_results_xml(path):
class ExecutionChecker(ResultVisitor):
def __init__(self):
self.results = {
'pass': 0,
'fail': 0,
@007bsd
007bsd / execution.py
Last active December 22, 2017 09:09
Snippet to collect executions statostics
import collections
from lxml import etree
def collect_suite_stats(suite_output):
"""
Extract suite execution statistics from output file
:param suite_output: file with suite output
:return: suite statistics
"""
def _suite_stats_collect(suite_root):
@007bsd
007bsd / loop.robot
Last active February 6, 2018 13:25
Loop through the block For loop
:FOR ${INDEX} IN RANGE 999999
\ Wait Until Keyword Succeeds 1 min 1 sec Drag And Drop By Offset xpath=//td[text()='${NAME}'] 0 -${OFFSET}
\ ${NEW_PAGE_2_LOCATION} Wait Until Keyword Succeeds 1 min 1 sec Get Vertical Position xpath=//td[text()='${NAME}']
\ ${NEW_PAGE_2_Y} Convert To Integer ${NEW_PAGE_2_LOCATION}
\ Exit For Loop If ${NEW_PAGE_2_Y} < ${PAGE_2_Y}
@007bsd
007bsd / LargeScreen.py
Created November 30, 2017 13:44
Capturing Large Screen Shot In Robot Framework
def capture_large_screenshot():
currentWindow = s2l.get_window_size()
page_height = s2l._current_browser().execute_script("return typeof(jQuery) !== 'undefined' ? jQuery(document).height() : 1080;")
page_width = currentWindow[0]
original_height = currentWindow[1]
s2l.set_window_size(page_width, page_height)
s2l.capture_page_screenshot()
s2l.set_window_size(page_width, original_height)
@007bsd
007bsd / anagrams.py
Last active November 12, 2017 12:31
Anagrams code for python
import string
def ara_anagrams():
str1 = input("Please input your first string : ")
str2 = input("Please input your second string : ")
exclude = sorted(set(string.punctuation))
str1 = ''.join(ch for ch in str1 if ch not in exclude)
str2 = ''.join(ch for ch in str2 if ch not in exclude)
if ''.join(sorted(set(str1.replace(" ", "").lower().strip()))) == ''.join(
*** Keywords ***
GET AUTH_TOKEN
[Arguments] ${CREDENTIALS}
Create Session AUTH ${ROOT_URL} verify=${True}
${resp}= POST Request AUTH /token
... headers=${HEADERS}
... data=${CREDENTIALS}
... timeout=${timeout}
Should Be Equal As Strings ${resp.status_code} 200
@007bsd
007bsd / Changejsoncode.py
Last active October 13, 2017 13:24
Modifying a json content
import json
import os
class Programs:
def __init__(self): # class constructur (called at creation time)
self.code = "" # the default name is the empty string
def catalogcode(code):
@007bsd
007bsd / robot_important.robot
Last active May 30, 2023 19:39
Important robot commands
1.
A: Rerun robot failed cases and Merge both them
#-----First execute the robot tests which are under tests folder
pybot -d results --output original.xml tests/mytest.robot
#-------Rerun the failed tests
pybot -d results --rerunfailed results/original.xml --output rerun.xml tests/mytest.robot
#----Mergeboth the results
rebot -d results --merge results/original.xml results/rerun.xml