0

I wish to automate my www.tori.fi browsing using robotframework. My biggest problem thus far is to get the robot to click on the "Hyväksy kaikki evästeet"- button. Simple Xpath targetting won't do, as it does not find the element. The popup is obsctructicating the website.

I tried this:

Click Element    //*[@id="notice"]/div[6]/button[2]

But the result was:

Element with locator '//*[@id="notice"]/div[6]/button[2]' not found

Image of the websites TOS

I am on Firefox browser.

1 Answer 1

0

When we find an overlay, we should suspect of it being inside a frame. This is the case in the site under testing.

Here is a complete working test suite:

*** Settings ***
Library           SeleniumLibrary

*** Test Cases ***
Click button in frame
    Open Browser    https://www.tori.fi/    firefox
    Sleep    5 seconds
    Select Frame    //iframe[@title="SP Consent Message"]
    ${button}=    Get WebElement    //button[@title="Hyväksy kaikki evästeet"]
    Click Element    ${button}
    Unselect Frame
    Sleep    5 seconds
    Capture Page Screenshot
    Close All Browsers
1
  • That indeed does it, thanks. Oct 10, 2022 at 21:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.