Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 43 lines (33 sloc) 1.653 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
# -*- coding: utf-8 -*-

# Copyright 2012 splinter authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.


class ClickElementsTest(object):

    def test_click_links(self):
        "should allow to click links"
        self.browser.find_link_by_text('FOO').first.click()
        assert 'BAR!' in self.browser.html

    def test_click_element_by_css_selector(self):
        "should allow to click at elements by css selector"
        self.browser.find_by_css('a[href="http://localhost:5000/foo"]').first.click()
        assert 'BAR!' in self.browser.html

    def test_click_input_by_css_selector(self):
        "should allow to click at inputs by css selector"
        self.browser.find_by_css('input[name="send"]').first.click()
        assert 'My name is: Master Splinter' in self.browser.html

    def test_click_link_by_href(self):
        "should allow to click link by href"
        self.browser.click_link_by_href('http://localhost:5000/foo')
        assert "BAR!" in self.browser.html

    def test_click_link_by_partial_href(self):
        "should allow to click link by partial href"
        self.browser.click_link_by_partial_href('5000/foo')
        assert "BAR!" in self.browser.html

    def test_click_link_by_text(self):
        "should allow to click link by text"
        self.browser.click_link_by_text('FOO')
        assert "BAR!" in self.browser.html

    def test_click_link_by_partial_text(self):
        "should allow to click link by partial text"
        self.browser.click_link_by_partial_text("wordier")
        assert "BAR!" in self.browser.html
Something went wrong with that request. Please try again.