Saturday, March 1, 2014

Add Cookie option

add_cookie(self, cookie_dict)

Adds a cookie to your current session.

:Args:
 - cookie_dict: A dictionary object, with required keys - "name" and "value";
    optional keys - "path", "domain", "secure", "expiry"

Usage:
    driver.add_cookie({'name' : 'foo', 'value' : 'bar'})
    driver.add_cookie({'name' : 'foo', 'value' : 'bar', 'path' : '/'})
    driver.add_cookie({'name' : 'foo', 'value' : 'bar', 'path' : '/', 'secure':True})

click_element/click_link when I don't have an id

The HTML code for it:
<li><a href="http://maps.skobbler.com/">Maps</a><span class="beta-tag">beta<span></span></span></li>

Whenever you don't have the ID for an element, use a get_element to find it. For example, here you'd use click_element or click_link with a nested get_element in it:
click_element(get_element(tag='a', href='http://maps.skobbler.com', text='Maps'))