File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 1+ """ Testing the "self.set_attribute()" and "self.set_attributes()" methods
2+ to modify a Google search into becoming a Bing search.
3+ set_attribute() -> Modifies the attribute of the first matching element.
4+ set_attributes() -> Modifies the attribute of all matching elements. """
5+
6+ from seleniumbase import BaseCase
7+
8+
9+ class HackingTest (BaseCase ):
10+
11+ def test_hack_search (self ):
12+ self .open ("https://google.com/ncr" )
13+ self .assert_element ('input[title="Search"]' )
14+ self .set_attribute ('[action="/search"]' , "action" , "//bing.com/search" )
15+ self .set_attributes ('[value="Google Search"]' , "value" , "Bing Search" )
16+ self .update_text ('input[title="Search"]' , "SeleniumBase GitHub" )
17+ self .click ('[value="Bing Search"]' )
18+ self .assert_element ("h1.b_logo" )
19+ self .click ('[href*="github.com/seleniumbase/SeleniumBase"]' )
20+ self .assert_element ('[href="/seleniumbase/SeleniumBase"]' )
21+ self .assert_true ("seleniumbase/SeleniumBase" in self .get_current_url ())
22+ self .click ('[title="examples"]' )
23+ self .assert_text ('examples' , 'strong.final-path' )
You can’t perform that action at this time.
0 commit comments