Skip to content

Instantly share code, notes, and snippets.

@aaltat
aaltat / alert.py
Last active August 25, 2015 20:08
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
driver = webdriver.Chrome()
driver.get('http://www.w3schools.com/js/tryit.asp?filename=tryjs_prompt')
driver.switch_to_frame('iframeResult')
from robot.libraries.BuiltIn import BuiltIn
def check_text(text):
s2l = BuiltIn().get_library_instance('Selenium2Library')
driver = s2l._current_browser()
for element in driver.find_elements_by_xpath('//*'):
if text in element.text:
return
raise ValueError('Text {} not from page'.format(text))
*** Settings ***
Library Selenium2Library
Library example.py
*** Test Cases ***
Example
Open Browser https://www.google.fi/ browser=gc
Check Text Google
[TEARDOWN] Close Browser
import shutil
import logging
import json
import os
import xml.etree.ElementTree as ET
from robot.errors import DataError
from finder import finder
from data_parser.data_parser import DataParser
from queue import ParsingQueue
from parser_utils.file_formatter import rf_table_name, lib_table_name
This file has been truncated, but you can view the full file.
=== Verbose logging started: 27/09/2016 10:12:35 Build type: SHIP UNICODE 5.00.7601.00 Calling process: C:\Windows\system32\msiexec.exe ===
MSI (c) (20:D8) [10:12:35:631]: Font created. Charset: Req=0, Ret=0, Font: Req=MS Shell Dlg, Ret=MS Shell Dlg
MSI (c) (20:D8) [10:12:35:631]: Font created. Charset: Req=0, Ret=0, Font: Req=MS Shell Dlg, Ret=MS Shell Dlg
MSI (c) (20:3C) [10:12:35:641]: Resetting cached policy values
MSI (c) (20:3C) [10:12:35:641]: Machine policy value 'Debug' is 0
MSI (c) (20:3C) [10:12:35:641]: ******* RunEngine:
******* Product: node-v4.5.0-x64.msi
******* Action:
@aaltat
aaltat / foobar.py
Created January 11, 2017 17:00
Register browser in Selenium2Library
from selenium import webdriver
from robot.libraries.BuiltIn import BuiltIn
def open_my_browser(url):
# Code here to open browser your my way
driver = webdriver.Chrome()
# Code here to open browser my way ends
driver.get(url)
s2l = BuiltIn().get_library_instance('Selenium2Library')
@aaltat
aaltat / s2l.py
Last active January 23, 2017 10:58
S2L new architecture
import inspect
from robot.api.deco import keyword
class FindElement(object):
def __init__(self, ctx):
self.ctx = ctx
@keyword
import time
from glance_dom import GlanceDom
from selenium import webdriver
driver = webdriver.Chrome()
driver.get('https://github.com/robotframework/SeleniumLibrary')
glance = GlanceDom(driver)
@aaltat
aaltat / appium.log
Created October 16, 2017 14:08
Appium server log when starting android settings
C:\workspace>appium
[Appium] Welcome to Appium v1.7.1
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
[HTTP] --> POST /wd/hub/session {"capabilities":{"alwaysMatch":{"platformName":"android"},
"firstMatch":[{}]},"desiredCapabilities":{"platformVersion":"7.0","appPackage":"com.androi
d.settings","platformName":"android","appActivity":".Settings","deviceName":"Galaxy J5 (20
17)"}}
[debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [{"platformVersion":"7.0
","appPackage":"com.android.settings","platformName":"android","appActivity":".Settings","
deviceName":"Galaxy J5 (2017)"},null,{"alwaysMatch":{"platformName":"android"},"firstMatch
@aaltat
aaltat / appium.log
Created November 1, 2017 14:57
ProxyRequestError with Appium 1.7.1
2017-11-01 15:51:01:644 - [Appium] New AndroidUiautomator2Driver session created successfully, session a1e4c991-e24b-4c71-910e-1c88a151e61f added to master session list
2017-11-01 15:51:01:644 - [debug] [BaseDriver] Event 'newSessionStarted' logged at 1509544261644 (15:51:01 GMT+0200 (EET))
2017-11-01 15:51:01:645 - [debug] [MJSONWP] Responding to client with driver.createSession() result: {"platformVersion":"6.0.1","appPackage":"com.android.settings","platformName":"android","appActivity":".Settings","deviceName":"Samsung_J5","newCommandTimeout":300,"noReset":true,"fullReset":false,"udid":"04f2cee7","automationName":"uiautomator2"}
2017-11-01 15:51:01:647 - [HTTP] <-- POST /wd/hub/session 200 44640 ms - 319
2017-11-01 15:51:03:399 - [HTTP] --> POST /wd/hub/session/a1e4c991-e24b-4c71-910e-1c88a151e61f/elements {"using":"xpath","sessionId":"a1e4c991-e24b-4c71-910e-1c88a151e61f","value":"//*[@text='Apps']"}
2017-11-01 15:51:03:402 - [debug] [MJSONWP] Calling AppiumDriver.findElements() with args: ["xpath","//*[