@@ -104,15 +104,15 @@ def login(self):
104
104
if self .logged_in :
105
105
return
106
106
logger .info ('Initiating log in' )
107
- self .driver .get ('https://www .pge.com/en/myhome/myaccount/index.page ' )
107
+ self .driver .get ('https://m .pge.com/' )
108
108
109
109
(username , password ), = self .wait_and_return (
110
110
self .find_username_and_password_in_any_frame )
111
111
logger .info ('Entering username and password' )
112
112
username .send_keys (self .credentials ['username' ])
113
113
password .send_keys (self .credentials ['password' ])
114
- with self . wait_for_page_load ():
115
- password . send_keys ( Keys . ENTER )
114
+ password . send_keys ( Keys . ENTER )
115
+ self . wait_and_return ( lambda : self . find_visible_elements ( By . ID , 'arrowBillPaymentHistory' ) )
116
116
logger .info ('Logged in' )
117
117
self .logged_in = True
118
118
@@ -136,7 +136,7 @@ def process_download(self, download_result, output_dir):
136
136
new_path = self .get_output_path (output_dir , date )
137
137
if os .path .exists (new_path ):
138
138
logger .info ('Skipping duplicate download: %s' , date )
139
- return True
139
+ return False
140
140
tmp_path = new_path .replace ('.pdf' , '.tmp.pdf' )
141
141
with open (tmp_path , 'wb' ) as f :
142
142
download_data = download_result [1 ]
@@ -157,15 +157,11 @@ def get_bills(self, output_dir):
157
157
actions .send_keys (Keys .ESCAPE )
158
158
actions .perform ()
159
159
logger .info ('Looking for download link' )
160
- (bills_link , ), = self .wait_and_return (
161
- lambda : self .find_visible_elements_by_descendant_partial_text ('BILL & PAYMENT HISTORY' , 'h2' ))
160
+ (bills_link , ), = self .wait_and_return (lambda : self .find_visible_elements (By .ID , 'arrowBillPaymentHistory' ))
162
161
scrape_lib .retry (lambda : self .click (bills_link ), retry_delay = 2 )
163
- (more_link , ), = self .wait_and_return (
164
- lambda : self .find_visible_elements_by_descendant_partial_text ('View up to 24 months of activity' , 'a' ))
162
+ (more_link , ), = self .wait_and_return (lambda : self .find_visible_elements (By .ID , 'href-view-24month-history' ))
165
163
scrape_lib .retry (lambda : self .click (more_link ), retry_delay = 2 )
166
- links , = self .wait_and_return (
167
- lambda : self .find_visible_elements (By .PARTIAL_LINK_TEXT , "View Bill PDF" )
168
- )
164
+ links , = self .wait_and_return (lambda : self .find_visible_elements (By .CSS_SELECTOR , ".utag-bill-history-view-bill-pdf" ))
169
165
170
166
for link in links :
171
167
if not self .do_download_from_link (link , output_dir ) and self .stop_early :
0 commit comments