From 5b521ba46a4bb4f3fdbdc196e9b09b1651b78e60 Mon Sep 17 00:00:00 2001 From: Andmedoctopus Date: Thu, 28 Dec 2023 15:47:49 +0200 Subject: [PATCH] Run google search only if called directly --- samples/test_google_search.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/samples/test_google_search.py b/samples/test_google_search.py index e35367c57..a9683b168 100755 --- a/samples/test_google_search.py +++ b/samples/test_google_search.py @@ -24,7 +24,7 @@ def test_filling_splinter_in_the_search_box_returns_splinter_website(self): self.browser.visit("http://www.google.com/") self.browser.fill("q", "splinter browser automation") # Circa April 2021, there are two identical inputs for a google search. We want the second one. - search_button = self.browser.find_by_xpath('//input[@value="Google Search"]')[1] + search_button = self.browser.find_by_xpath("//input[@value="Google Search"]")[1] while not search_button.visible: # Wait for the JavaScript to put the button on the page pass @@ -32,4 +32,5 @@ def test_filling_splinter_in_the_search_box_returns_splinter_website(self): self.assertTrue(self.browser.is_text_present("https://splinter.readthedocs.io")) -unittest.main() +if __name__ == "__main__": + unittest.main()