Skip to content

Instantly share code, notes, and snippets.

@aaltat
aaltat / robotframework.tmLanguage
Created May 8, 2020 11:40
Robot Framework tmLanguage
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"fileTypes": [
"robot"
],
"repository": {
"settings_table": {
"begin": "(?i)^(\\*+ ?(?:Settings|Setting)[ *]*)(?= {2,}| ?\\t| ?$)",
"beginCaptures": {
"1": {
@aaltat
aaltat / __init__pyi
Created May 2, 2020 21:13
SeleniumLibrary __init__.pyi
from SeleniumLibrary.base import DynamicCore as DynamicCore, LibraryComponent as LibraryComponent
from SeleniumLibrary.errors import NoOpenBrowser as NoOpenBrowser, PluginError as PluginError
from SeleniumLibrary.keywords import AlertKeywords as AlertKeywords, BrowserManagementKeywords as BrowserManagementKeywords, CookieKeywords as CookieKeywords, ElementKeywords as ElementKeywords, FormElementKeywords as FormElementKeywords, FrameKeywords as FrameKeywords, JavaScriptKeywords as JavaScriptKeywords, RunOnFailureKeywords as RunOnFailureKeywords, ScreenshotKeywords as ScreenshotKeywords, SelectElementKeywords as SelectElementKeywords, TableElementKeywords as TableElementKeywords, WaitingKeywords as WaitingKeywords, WebDriverCache as WebDriverCache, WindowKeywords as WindowKeywords
from SeleniumLibrary.keywords.screenshot import EMBED as EMBED
from SeleniumLibrary.locators import ElementFinder as ElementFinder
from SeleniumLibrary.utils import LibraryListener as LibraryListener, is_truthy as is_truthy, timestr_t
@aaltat
aaltat / cmd
Created April 9, 2020 14:38
pytest log problem
(venv) C:\tmp>python -m pytest -p no:faulthandler test_pywinauto.py
================================================= test session starts =================================================
platform win32 -- Python 3.8.2, pytest-5.4.1, py-1.8.1, pluggy-0.13.1
rootdir: C:\tmp
collected 1 item
src\test_pywinauto.py Windows fatal exception: code 0x80040155
Current thread 0x00001128 (most recent call first):
File "C:\Python38-32\lib\site-packages\pywinauto\uia_element_info.py", line 269 in _get_elements
@aaltat
aaltat / py_finder.py
Last active March 2, 2020 00:03
Find files which are not Python 3 compatible
import argparse
import subprocess
from pathlib import Path
def find_files(src_root: Path, python3: Path):
not_py3_compatible = []
for file in src_root.rglob('*.py'):
print(file.resolve())
@aaltat
aaltat / page.html
Created October 7, 2019 20:59
Input field
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
driver = webdriver.Chrome()
driver.get('file:///path/to/page.html')
element = driver.find_element_by_id('text_field')
action = ActionChains(driver)
for text in ['AA', 'BB', 'CC']:
action.send_keys_to_element(element, text)
@aaltat
aaltat / Plugin.py
Created March 1, 2019 20:25
SeleniumLibrary plugin API and keyword documentation
from collections import namedtuple
from robot.utils.importer import Importer
from SeleniumLibrary.base import DynamicCore
class Plugin(DynamicCore):
"""PLugin documentation here.
Decice what goes here
@aaltat
aaltat / geckodriver.log
Created October 31, 2018 19:12
Firefox element screenshot problem
1540935303315 mozrunner::runner INFO Running command: "/usr/bin/firefox" "-marionette" "-foreground" "-no-remote" "-profile" "/tmp/rust_mozprofile.Cn8nN09Ixa9U"
(firefox:14143): Gtk-WARNING **: 23:35:04.189: Theme parsing error: <data>:1:34: Expected ')' in color definition
(firefox:14143): Gtk-WARNING **: 23:35:04.189: Theme parsing error: <data>:1:77: Expected ')' in color definition
1540935306051 Marionette INFO Listening on port 36581
1540935306099 Marionette WARN TLS certificate errors will be ignored for this session
1540935306428 Marionette INFO Stopped listening on port 36581
JavaScript error: resource://activity-stream/lib/TopSitesFeed.jsm, line 86: TypeError: setting getter-only property "_currentSearchHostname"
1541012371437 mozrunner::runner INFO Running command: "/usr/bin/firefox" "-marionette" "-foreground" "-no-remote" "-profile" "/tmp/rust_mozprofile.Vny9Bp9ej1vg"
def my_keyword(dlist):
selected = []
for dict_item in dlist:
platform = dict_item['platforms']
if 'mac' in platform and dict_item['language'] == 'en':
selected.append(dict_item)
elif 'all_platforms' in platform:
selected.append(dict_item)
return selected
@aaltat
aaltat / test.py
Created March 12, 2018 20:03
Firefox move_to_element bug
from __future__ import print_function
import time
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
driver = webdriver.Firefox()
driver.get('https://github.com/robotframework/SeleniumLibrary')
xpath = '//*[@id="user-content-history"]'
@aaltat
aaltat / unlockType.log
Created November 8, 2017 14:19
Appium UIAutomator2 unlockType
2017-11-08 16:02:36:034 - info: [Appium] Welcome to Appium v1.7.1
2017-11-08 16:02:36:038 - info: [Appium] Non-default server args:
2017-11-08 16:02:36:039 - info: [Appium] address: 127.0.0.1
2017-11-08 16:02:36:041 - info: [Appium] sessionOverride: true
2017-11-08 16:02:36:043 - info: [Appium] log: appium.log
2017-11-08 16:02:36:044 - info: [Appium] logTimestamp: true
2017-11-08 16:02:36:045 - info: [Appium] localTimezone: true
2017-11-08 16:02:36:047 - info: [Appium] logNoColors: true
2017-11-08 16:02:36:048 - info: [Appium] suppressKillServer: true
2017-11-08 16:02:36:050 - info: [Appium] defaultCapabilities: {