@@ -769,26 +769,29 @@ def test_presentation_4(self):
769769 )
770770 self .begin_presentation (filename = "uc_presentation.html" )
771771
772- with SB (
773- uc = True , test = True , locale = "en" , guest = True , ad_block = True
774- ) as sb :
772+ with SB (uc = True , test = True , locale = "en" , guest = True , pls = "none" ) as sb :
775773 url = "https://www.priceline.com"
776774 sb .activate_cdp_mode (url )
777- sb .sleep (1.8 )
778- sb .click ('input[name="endLocation"]' )
775+ sb .sleep (2.6 )
776+ input_selector = '[name="endLocation"]'
777+ if not sb .is_element_present (input_selector ):
778+ input_selector = "div.location-input input"
779+ sb .click (input_selector )
779780 sb .sleep (1.2 )
780- location = "Portland, Oregon, US "
781+ location = "Portland, OR "
781782 selection = "Oregon, United States" # (Dropdown option)
782- sb .press_keys ('input[name="endLocation"]' , location )
783- sb .sleep (0.5 )
784- sb .click_if_visible ('input[name="endLocation"]' )
785- sb .sleep (0.5 )
783+ sb .press_keys (input_selector , location )
784+ sb .sleep (0.6 )
786785 sb .click (selection )
786+ sb .sleep (0.4 )
787787 sb .scroll_down (25 )
788- sb .click_if_visible ('button[aria-label="Dismiss calendar"]' )
789- sb .click_if_visible ("div.sidebar-iframe-close" )
790- sb .click_if_visible ('div[aria-label="Close Modal"]' )
791- sb .click ('button[data-testid="HOTELS_SUBMIT_BUTTON"]' )
788+ sb .sleep (0.4 )
789+ calendar_close = 'button[aria-label="Dismiss calendar"]'
790+ if not sb .is_element_visible (calendar_close ):
791+ calendar_close = '[data-mode="range"] span.px-1'
792+ sb .click (calendar_close )
793+ sb .sleep (0.6 )
794+ sb .click ('form button[type="submit"]' )
792795 sb .sleep (4.8 )
793796 if len (sb .cdp .get_tabs ()) > 1 :
794797 sb .cdp .close_active_tab ()
@@ -798,15 +801,24 @@ def test_presentation_4(self):
798801 for y in range (1 , 9 ):
799802 sb .scroll_to_y (y * 400 )
800803 sb .sleep (0.5 )
801- hotel_names = sb .find_elements (
802- 'a[data-autobot-element-id*="HOTEL_NAME"]'
803- )
804- if sb .is_element_visible ('[font-size="4,,,5"]' ):
805- hotel_prices = sb .find_elements ('[font-size="4,,,5"]' )
806- else :
804+ hotel_names = sb .find_elements ('h3 div[class*="TitleName"]' )
805+ if not hotel_names :
806+ hotel_names = sb .find_elements (
807+ 'a[data-autobot-element-id*="HOTEL_NAME"]'
808+ )
809+ price_selector = '[class*="PriceWrap"] .relative > .items-center'
810+ if sb .is_element_visible (price_selector ):
811+ hotel_prices = sb .find_elements (price_selector )
812+ elif sb .is_element_present (
813+ '[font-size="12px"] + [font-size="20px"]'
814+ ):
807815 hotel_prices = sb .find_elements (
808816 '[font-size="12px"] + [font-size="20px"]'
809817 )
818+ else :
819+ hotel_prices = sb .find_elements (
820+ 'span.text-priceSuper-heading4 + div > span'
821+ )
810822 print ("Priceline Hotels in %s:" % location )
811823 print (sb .get_text ('[data-testid="POPOVER-DATE-PICKER"]' ))
812824 if len (hotel_names ) == 0 :
@@ -816,6 +828,8 @@ def test_presentation_4(self):
816828 if hotel_prices [i ] and hotel_prices [i ].text :
817829 count += 1
818830 hotel_price = "$" + hotel_prices [i ].text
831+ if hotel_price .startswith ("$$ " ):
832+ hotel_price = hotel_price .replace ("$$ " , "$" )
819833 print ("* %s: %s => %s" % (count , hotel .text , hotel_price ))
820834
821835 self .create_presentation (theme = "serif" , transition = "none" )
0 commit comments