@@ -17,6 +17,7 @@ def __init__(self, browser: Browser):
17
17
self .browser = browser
18
18
self .activities = Activities (browser )
19
19
20
+ # todo Refactor so less complex
20
21
def completeMorePromotions (self ):
21
22
# Function to complete More Promotions
22
23
logging .info ("[MORE PROMOS] " + "Trying to complete More Promotions..." )
@@ -56,21 +57,17 @@ def completeMorePromotions(self):
56
57
searchbar .send_keys ("aliens movie" )
57
58
searchbar .submit ()
58
59
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 ()
62
62
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 ()
66
65
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 ()
70
68
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 ()
74
71
elif "Too tired to cook tonight?" in promotionTitle :
75
72
searchbar .send_keys ("pizza delivery near me" )
76
73
searchbar .submit ()
@@ -99,12 +96,15 @@ def completeMorePromotions(self):
99
96
self .activities .completeSearch ()
100
97
self .browser .webdriver .execute_script ("window.scrollTo(0, 1080)" )
101
98
time .sleep (random .randint (5 , 10 ))
99
+
100
+ # todo Bundle this into one notification
102
101
pointsAfter = self .browser .utils .getAccountPoints ()
103
102
if pointsBefore == pointsAfter :
104
103
Utils .sendNotification (
105
104
"Incomplete promotion" ,
106
105
f"title={ promotionTitle } type={ promotion ['promotionType' ]} " ,
107
106
)
107
+
108
108
self .browser .utils .resetTabs ()
109
109
time .sleep (2 )
110
110
except Exception : # pylint: disable=broad-except
0 commit comments