Skip to content

Commit 909c105

Browse files
committed
Do a real search versus via url
1 parent 24242f9 commit 909c105

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/morePromotions.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ def __init__(self, browser: Browser):
1717
self.browser = browser
1818
self.activities = Activities(browser)
1919

20+
# todo Refactor so less complex
2021
def completeMorePromotions(self):
2122
# Function to complete More Promotions
2223
logging.info("[MORE PROMOS] " + "Trying to complete More Promotions...")
@@ -56,21 +57,17 @@ def completeMorePromotions(self):
5657
searchbar.send_keys("aliens movie")
5758
searchbar.submit()
5859
elif "Discover open job roles" in promotionTitle:
59-
self.browser.webdriver.get(
60-
"https://www.bing.com/search?q=walmart+open+job+roles"
61-
)
60+
searchbar.send_keys("walmart open job roles")
61+
searchbar.submit()
6262
elif "Plan a quick getaway" in promotionTitle:
63-
self.browser.webdriver.get(
64-
"https://www.bing.com/search?q=flights+nyc+to+paris"
65-
)
63+
searchbar.send_keys("flights nyc to paris")
64+
searchbar.submit()
6665
elif "You can track your package" in promotionTitle:
67-
self.browser.webdriver.get(
68-
"https://www.bing.com/search?q=usps+tracking"
69-
)
66+
searchbar.send_keys("usps tracking")
67+
searchbar.submit()
7068
elif "Find somewhere new to explore" in promotionTitle:
71-
self.browser.webdriver.get(
72-
"https://www.bing.com/search?q=directions+to+new+york"
73-
)
69+
searchbar.send_keys("directions to new york")
70+
searchbar.submit()
7471
elif "Too tired to cook tonight?" in promotionTitle:
7572
searchbar.send_keys("pizza delivery near me")
7673
searchbar.submit()
@@ -99,12 +96,15 @@ def completeMorePromotions(self):
9996
self.activities.completeSearch()
10097
self.browser.webdriver.execute_script("window.scrollTo(0, 1080)")
10198
time.sleep(random.randint(5, 10))
99+
100+
# todo Bundle this into one notification
102101
pointsAfter = self.browser.utils.getAccountPoints()
103102
if pointsBefore == pointsAfter:
104103
Utils.sendNotification(
105104
"Incomplete promotion",
106105
f"title={promotionTitle} type={promotion['promotionType']}",
107106
)
107+
108108
self.browser.utils.resetTabs()
109109
time.sleep(2)
110110
except Exception: # pylint: disable=broad-except

0 commit comments

Comments
 (0)