test_1575000_lloydsbank.py (1702B)
1 import pytest 2 from webdriver.error import NoSuchElementException 3 4 URL = ( 5 "https://apply.lloydsbank.co.uk/sales-content/cwa/l/pca/index-app.html" 6 "?product=classicaccountLTB" 7 ) 8 9 NO_CSS = "[data-selector='existingCustomer-toggle-button-no']" 10 CONT_CSS = "[data-selector='ib-yes-continue-without-login-not-existing-customer-continue-button']" 11 CONT2_CSS = "[data-selector='beforeYouStart-continue-button']" 12 RADIO_CSS = "[name='aboutYou-gender-radio'] + span" 13 COOKIES_CSS = "#lbganalyticsCookies" 14 15 16 async def get_radio_position(client): 17 loadedProperly = False 18 for i in range(0, 10): 19 await client.navigate(URL, wait="none") 20 try: 21 loadedProperly = client.await_css(NO_CSS, timeout=3) 22 except NoSuchElementException: 23 continue 24 try: 25 client.remove_element(client.await_css(COOKIES_CSS, timeout=4)) 26 except NoSuchElementException: 27 continue 28 client.await_css(NO_CSS).click() 29 client.await_css(NO_CSS).click() 30 client.await_css(CONT_CSS).click() 31 client.await_css(CONT2_CSS).click() 32 break 33 if not loadedProperly: 34 pytest.xfail("The website seems to not be loading properly") 35 return False 36 radio = client.await_css(RADIO_CSS) 37 return client.execute_script( 38 """ 39 return window.getComputedStyle(arguments[0]).position; 40 """, 41 radio, 42 ) 43 44 45 @pytest.mark.asyncio 46 @pytest.mark.with_interventions 47 async def test_enabled(client): 48 assert "relative" == await get_radio_position(client) 49 50 51 @pytest.mark.asyncio 52 @pytest.mark.without_interventions 53 async def test_disabled(client): 54 assert "relative" != await get_radio_position(client)