@@ -159,15 +159,29 @@ def _get_metadata(self):
159
159
def get_image (self ):
160
160
"""Get a binary PNG image in memory."""
161
161
self .wait (self .min_wait )
162
- elem = self .driver .find_element (
163
- "xpath" , "/html/body/div[3]/div[3]/div/div/div[2]/div[3]" )
162
+
163
+ def _find_clickable_element_to_enlarge_image ():
164
+ try :
165
+ # Without ArtRemix/PoemPostcard
166
+ elem = self .driver .find_element (
167
+ "xpath" , "/html/body/div[3]/div[3]/div/div/div[2]/div[3]" )
168
+ except NoSuchElementException :
169
+ # With ArtRemix/PoemPostcard
170
+ elem = self .driver .find_element (
171
+ "xpath" , "/html/body/div[3]/div[3]/div/div/div[3]/div[3]/div[1]" )
172
+
173
+ return elem
174
+
175
+ # Find element to click on to enlarge image
176
+ elem = _find_clickable_element_to_enlarge_image ()
164
177
165
178
webdriver .ActionChains (
166
179
self .driver ).move_to_element (elem ).click (elem ).perform ()
167
180
168
181
self .wait (self .min_wait * 2 , update = False )
169
- elem = self .driver .find_element (
170
- "xpath" , "/html/body/div[3]/div[3]/div/div/div[2]/div[3]" )
182
+
183
+ # Find element to click on to enlarge image, again
184
+ elem = _find_clickable_element_to_enlarge_image ()
171
185
172
186
img = elem .screenshot_as_png
173
187
@@ -210,9 +224,11 @@ def save_artwork_information(self, link):
210
224
Artwork URL.
211
225
212
226
"""
227
+
213
228
self .load_link (link )
214
229
self .save_metadata ()
215
230
self .save_image ()
216
231
232
+
217
233
def close (self ):
218
234
self .driver .quit ()
0 commit comments