selenium skeleton and README
This commit is contained in:
parent
52707f87e7
commit
c5a8773b17
7
selenium/README
Normal file
7
selenium/README
Normal file
@ -0,0 +1,7 @@
|
||||
Directory containing testscases for testing the wallet with Selenium ChromeDriver.
|
||||
|
||||
[1] Contains the ChromeDriver Pythonic documentation
|
||||
[2] Tells which fields (and which values) the 'loggingPrefs' capability expects
|
||||
|
||||
[1] http://seleniumhq.github.io/selenium/docs/api/py/index.html
|
||||
[2] https://github.com/SeleniumHQ/selenium/wiki/DesiredCapabilities#loggingpreferences-json-object
|
32
selenium/wallet-test.py
Normal file
32
selenium/wallet-test.py
Normal file
@ -0,0 +1,32 @@
|
||||
from selenium import webdriver
|
||||
import time
|
||||
|
||||
co = webdriver.ChromeOptions()
|
||||
co.add_argument("load-extension=/home/marcello/Taler/wallet-webex")
|
||||
cap = webdriver.DesiredCapabilities.CHROME.copy()
|
||||
cap['loggingPrefs'] = {'driver': 'INFO', 'browser': 'INFO'}
|
||||
client = webdriver.Chrome(chrome_options=co, desired_capabilities=cap)
|
||||
client.get('https://taler.net')
|
||||
listener = """\
|
||||
document.addEventListener('taler-id', function(evt){
|
||||
window['extId'] = evt.detail.id;
|
||||
});
|
||||
evt = new CustomEvent('taler-query-id');
|
||||
document.dispatchEvent(evt);
|
||||
"""
|
||||
client.execute_script(listener)
|
||||
poll = """\
|
||||
if(window.extId)
|
||||
return window.extId;
|
||||
else return false;
|
||||
"""
|
||||
# TODO intelligent poller needed
|
||||
time.sleep(1)
|
||||
ext_id = client.execute_script(poll)
|
||||
|
||||
labels = ['balance']
|
||||
for l in labels:
|
||||
client.get('chrome-extensio://' + ext_id + '/popup/popup.html#/' + l)
|
||||
for log_type in ['browser']:
|
||||
for log in client.get_log(log_type):
|
||||
print(log['level'] + ': ' + log['message'])
|
Loading…
Reference in New Issue
Block a user