-2

I have tried a lot of options but have been unable to solve the issue in firefox where my code doesnt seem to find the element even though it is clearly visible in view.

My code is below (pasted from declaration of variables) ''' *** Variables ***

${Combo_Boxes_Product_Page_Enter_Pincode} = id=pincode_field_id

${Postcode}

${Combo_Boxes_Product_Page_Check_My_Postcode} = id=checkpin

${Combo_Boxes_Product_Page_Add_To_Cart} = class=single_add_to_cart_button

${Combo_Boxes_Product_Page_Added_To_Cart} = class=single_add_to_cart_button.button.alt.added

${Cart_Icon} = class=woo_amc_container_wrap woo_amc_container_wrap_right

${Combo_Boxes_Product_Details_Header} = xpath=//*[@id="all-page-header-space"]/div/div[2]/div

${Number_Of_Products_Start}

${Number_Of_Products}

${Increase_Quantity} = class=qty_button.plus

${Subscription_Radio_Button} = xpath=//*[@id="subscriptions-list"]

${Subscription_Options} = name=subscription-options

${Subscription_Interval}

${Window_Width}

${Window_Height}

${Product_Details} = xpath=/html/body/section[5]/div/div[1]/div[2]/div

*** Keywords ***

Add Subscription

[Arguments]     ${Number_Of_Products}     ${Subscription_Interval}

Input Text    ${Combo_Boxes_Product_Page_Enter_Pincode}   ${Postcode}

Sleep    1s

Click Element    ${Combo_Boxes_Product_Page_Check_My_Postcode}

Sleep   1s

Set Log Level    Debug
Wait Until Page Contains Element    ${Product_Details}
Click Element At Coordinates    ${Subscription_Radio_Button}  0  0
Select Radio Button    purchase-options   subscription
Sleep    1s
List Selection Should Be    ${Subscription_Options}     ${Subscription_Interval}
FOR  ${Number_Of_Products_Start}    IN    1    ${Number_Of_Products}
     Exit For Loop If    ${Number_Of_Products_Start} == ${Number_Of_Products}
     Click Element    ${Increase_Quantity}
     ${Number_Of_Products_Start} =  Evaluate  ${Number_Of_Products_Start}+1
END
Click Element    ${Combo_Boxes_Product_Page_Add_To_Cart}
Sleep    3s
Wait Until Page Contains Element    ${Combo_Boxes_Product_Page_Added_To_Cart}
Sleep   1s

'''

The error message i am getting is

09:21:31.324 INFO Clicking element 'xpath=//*[@id="subscriptions-list"]' at coordinates x=0, y=0. 09:21:32.190 FAIL MoveTargetOutOfBoundsException: Message: (-4800, 904) is out of bounds of viewport width (1920) and height (1006)

I have also added the screenshot that shows the field is clearly visible. Could someone please help me solve this as this is holding my entire suite up. Is me using two screens causing an issue? I am also confused with the message where it seems to show the offset as a negative value.

1 Answers1

0

Why are you using click at coordinate for a radio button ?

Use Click Element

Click Element ${Subscription_Radio_Button}

PDHide
  • 18,113
  • 2
  • 31
  • 46
  • Hi PDHide, i have tried Click Element, just using select radio button, i have tried clicking at a position lower than where the radio button is all with the same error. When i attempt just - Select Radio Button i get the following error - ElementNotInteractableException: Message: Element could not be scrolled into view – CBSolomon Nov 26 '20 at 12:57
  • Add your radio button html – PDHide Nov 26 '20 at 13:01
  • `Scroll Element Into View ${Subscription_Radio_Button` – PDHide Nov 26 '20 at 13:03
  • Try this before clicking and see what's happening – PDHide Nov 26 '20 at 13:03
  • I have tried scrolling element into view. Error - MoveTargetOutOfBoundsException: Message: (-4800, 904) is out of bounds of viewport width (1920) and height (1006) – CBSolomon Nov 26 '20 at 13:32
  • Add the html please – PDHide Nov 26 '20 at 13:43
  • coordinates 0 0 is left most bottom or so, are you sure the element is located there? I had the same issue once, it had a 2 step solution. something like Mouse Over locator Mouse Down locator that worked somehow... or it was like so: Set Focus To Element locator Mouse Over locator Mouse Down locator I could not reason why that worked, but it worked I remember. – tijnn Nov 26 '20 at 14:18