Created
June 21, 2011 01:03
-
-
Save adamgoucher/1036998 to your computer and use it in GitHub Desktop.
sizzly dom locators
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pytest | |
import selenium | |
class TestRemoteControl(): | |
def setup_method(self, method): | |
self.connection = selenium.selenium("localhost", 4444, "*firefox", "http://saucelabs.com") | |
self.connection.start() | |
self.connection.window_maximize() | |
self.connection.open("/signup") | |
def teardown_method(self, method): | |
self.connection.stop() | |
def test_sizzly_css(self): | |
self.connection.type('css=td > input:first', 'sizzly') | |
assert str(self.connection.get_value('id=username')) == 'sizzly' | |
def test_css_first_of_type(self): | |
self.connection.type('css=td > input:first-of-type', 'firstoftype') | |
assert str(self.connection.get_value('id=username')) == 'firstoftype' | |
def test_css_nth_of_type(self): | |
self.connection.type('css=td > input:nth-of-type(1)', 'nthoftype') | |
assert str(self.connection.get_value('id=username')) == 'nthoftype' | |
def test_sizzle_via_dom(self): | |
self.connection.type('dom=Sizzle("td > input:first", window.document)[0]', "dom") | |
assert str(self.connection.get_value('id=username')) == 'dom' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment