Skip to content

Instantly share code, notes, and snippets.

View emanlove's full-sized avatar

Ed Manlove emanlove

  • Rhode Island
View GitHub Profile
@emanlove
emanlove / debug.txt
Created August 4, 2012 16:02
robotframework debug output
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+---- START KW: Selenium2Library.Click Link [ Target opens in new window ]
Clicking link 'Target opens in new window'.
GET http://127.0.0.1:34105/hub/session/299ebe07-637d-4658-bc3e-45fb0a848a42/url {"sessionId": "299ebe07-637d-4658-bc3e-45fb0a848a42"}
POST http://127.0.0.1:34105/hub/session/299ebe07-637d-4658-bc3e-45fb0a848a42/elements {"using": "xpath", "sessionId": "299ebe07-637d-4658-bc3e-45fb0a848a42", "value": "//a[(@id='Target opens in new window' or @name='Target opens in new window' or @href='Target opens in new window' or normalize-space(descendant-or-self::text())='Target opens in new window' or @href='http://localhost:7000/html/Target opens in new window')]"}
POST http://127.0.0.1:34105/hub/session/299ebe07-637d-4658-bc3e-45fb0a848a42/element/{1379730d-de5b-40d5-b15e-753806d45aed}/click {"sessionId": "299ebe07-637d-4658-bc3e-45fb0a848a42", "id": "{1379730d-de5b-40d5-b15e-753806d45aed}"}
+---- END KW: Selenium2Library.Cl
@emanlove
emanlove / testHangs.py
Created August 5, 2012 00:30
selenium call which hangs
import unittest
from selenium import webdriver
class SwitchToWindow(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Firefox()
def test_switch_to_window(self):
driver = self.driver
@emanlove
emanlove / SampleLibrary.py
Created January 7, 2016 11:11
Overriding methods of object within another RF Library
import types
from robot.libraries.BuiltIn import BuiltIn
class SampleLibrary(object):
_s2l = BuiltIn().get_library_instance('Selenium2Library')
def __init__(self):
# override Selenium2Library's _find_by_default method
import pdb,sys; pdb.Pdb(stdout=sys.__stdout__).set_trace()
# self._s2l._element_finder._find_by_default = types.MethodType(self._override_function, self._s2l._element_finder)
@emanlove
emanlove / waitForAngularCore.js
Created June 7, 2017 00:31
Test code that is run in browser devtools/console window proving out javascipt code for mimicing Protractor's waitForAngular function.
var callback = function () {console.log('*')};
var el = document.querySelector('[ng-app]');
var h = setInterval(function w4ng() {
console.log('.');
try {
if (window.angular && !(window.angular.version &&
window.angular.version.major > 1)) {
/* ng1 */
angular.element(el).injector().get('$browser').
notifyWhenNoOutstandingRequests(callback);
@emanlove
emanlove / check.robot
Created April 5, 2018 23:47
Robot Framework output of test importing AngularJSLibrary
*** Settings ***
Library String
Library Collections
Library OperatingSystem
Library SeleniumLibrary
Library AngularJSLibrary
*** Test Cases ***
Simple Log
@emanlove
emanlove / BasicForm.html
Created June 15, 2018 10:03
Debug scripts to determine where the issue is when IE / Robot Framework / Selenium / Web Application translates ~O as Ö
<html>
<head></head>
<body>
<form>
<input id="editbox" type="text" />
</form>
</body>
</html>
@emanlove
emanlove / Functionality-For-Robot-Framework-IDE-Editor.rst
Last active July 1, 2018 11:18
Documenting desired functionality for any Robot Framework IDE or Editor.

Functionality for Robot Framework IDE or Editor

Running list of functionality and features that make up a useful set of tools within an IDE or Editor.

Functionality I would like to see

  • RTL support
  • show formatting marks (similar to what one sees in Word or LibreOffice)
@emanlove
emanlove / robotframework-lsp-functionality.rst
Created April 21, 2020 17:43
Language Server Functionality

Implemented

Launch .robot files [Ed: Does this mean executing robot scripts or loading/"opening" files in an editor?] Code completion for keywords, section headers and section settings Go to definition for keywords (new in 0.0.9) Syntax highlighting [Ed: list of syntax?][Ed: is this done by the lsp or the grammer and ide?] Syntax validation [Ed: is this done by the lsp or the grammer and ide?] Code Formatting [? definition]

Other ideas

@emanlove
emanlove / parseChromedriverversion.bat
Created October 3, 2022 11:39
Method for parsing chromerdriver version programmatically
for /F "tokens=2" %%v in ('chromedriver --version') do (
set Version=%%v
for /F "tokens=1,2,3,4 delims=." %%a in ("%Version%") do (
set Major=%%a
set Minor=%%b
set Revision=%%c
set Tail=%%d
)
)
@emanlove
emanlove / example.py
Created May 5, 2023 14:22
Adding logging to Python Selenium unit tests
import logging
import sys
root = logging.getLogger()
root.setLevel(logging.DEBUG)
handler = logging.StreamHandler(sys.stdout)
handler.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
handler.setFormatter(formatter)