-1

Here is the code that I am using

Resource file code

*** Settings ***

Library  SeleniumLibrary

Variables       ../PageObject/inspectpath.py

*** Keywords ***

open my browser

    [Arguments]    ${siteurl}   ${browser}
    open browser    ${siteurl}   ${browser}
    maximize browser window

Testcase file

*** Settings ***

Library    SeleniumLibrary

Resource   ../Resources/OCKeywords.robot


*** Variables ***

${browser}      chrome

${siteurl}     http://automationpractice.com/index.php



*** Test Cases ***

Register

    open my browser     ${browser}      ${siteurl}
Anand Gautam
  • 2,018
  • 1
  • 3
  • 8
  • Can you share your actual code? What you've written isn't clear. – Thorium Aug 19 '22 at 11:06
  • 2
    Your `open my browser` has arguments `${siteurl}` `${browser}` But you are passing in your test file `${browser}` `${siteurl}`. It should be `${siteurl}` `${browser}` – Anand Gautam Aug 19 '22 at 11:09

1 Answers1

0

The first argument to your open my browser keyword is the site url, and the second is the name of the browser. That is because you defined the arguments like this:

[Arguments]    ${siteurl}   ${browser}

However, when you call it you are sending the arguments in reverse order here:

open my browser     ${browser}      ${siteurl}

The solution is to pass the arguments in the correct order:

open my browser     ${siteurl}  ${browser} 
Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685
  • Thank you for the solution @Bryan Oakley I also compared my old project file with this but didn't recognize this small mistake. – Sporty Spartan Aug 22 '22 at 07:32