简体   繁体   English

Katalon Export-机器人框架问题

[英]Katalon Export - Robot Framework Issue

Hi I have exported the below test case from Katalon recorder to Robot Framework code.I am trying to run this in PyCharm or RIDE using Python 2.7. 嗨,我已经将下面的测试用例从Katalon记录器导出到了Robot Framework代码中,我正在尝试使用Python 2.7在PyCharm或RIDE中运行它。 PyCharm and RIDE both seem to not like the Resource seleniumLibrary.robot code. PyCharm和RIDE似乎都不喜欢Resource seleniumLibrary.robot代码。

How can I import this seleniumLibrary.robot file? 如何导入此seleniumLibrary.robot文件? Where is it? 它在哪里? I have downloaded Robot Framework, SeleniumLibrary, Selenium2Library, WxPython, and RIDE and all are working now I am just trying to get this code to run. 我已经下载了Robot Framework,SeleniumLibrary,Selenium2Library,WxPython和RIDE,并且它们都在工作,现在我只是想让此代码运行。

I followed the instructions below to get up and running 我按照以下说明进行操作

http://seleniummaster.com/sitecontent/index.php/selenium-robot-framework-menu/selenium-robot-framework-python-menu/191-selenium-robot-framework-installation-with-python http://seleniummaster.com/sitecontent/index.php/selenium-robot-framework-menu/selenium-robot-framework-python-menu/191-selenium-robot-framework-installation-with-python

*** Settings ***
Suite Setup    Open Browser    https://www.katalon.com/    firefox
Suite Teardown    Close Browser
Resource    seleniumLibrary.robot

*** Variables ***
${undefined}    https://www.katalon.com/

*** Test Cases ***
Test Case
    open    https://abcxyz.com/catalog-portal/
    click    xpath=//div[5]/div/div[2]/img
    selectWindow    win_ser_1
    selectFrame    index=0
    click    xpath=//td[@onclick="if (warnUnfinishedPage()) return false; changePage('pc.quote.html.QuoteSummarySection','refresh');  return false;"]
    click    xpath=(.//*[normalize-space(text()) and normalize-space(.)='Email'])[1]/following::td[5]
    type    name=t1st__TBOX    603449
    click    xpath=(.//*[normalize-space(text()) and normalize-space(.)='All'])[2]/following::input[1]
    click    link=Q603449
    click    link=Email
    addSelection    id=null    Doe, John (abc@abc.com)
    click    xpath=(.//*[normalize-space(text()) and normalize-space(.)='Email this Quote'])[1]/following::input[2]
    select    name=FORMAT    Text
    click    link=Send
    close    win_ser_1
    selectWindow    win_ser_local
    close    win_ser_local

The settings and variables sections are mostly placeholders. 设置和变量部分主要是占位符。 You should customize these to be compatible with the development environment you have created. 您应该自定义这些属性以使其与您创建的开发环境兼容。

In this case the resource file seleniumLibrary.robot needs to be created in the Resources folder of your project. 在这种情况下,需要在项目的Resources文件夹中创建资源文件seleniumLibrary.robot

EXAMPLE FOR COMPLETELY NEW PROJECT: 全新项目示例:

  1. Create a new folder for your project 为您的项目创建一个新文件夹
  2. Create folder named "Resources" in the root of your project folder 在项目文件夹的根目录中创建名为“ Resources”的文件夹
  3. Create folder named "Testsuites" in the root of your project folder 在项目文件夹的根目录中创建名为“ Testsuites”的文件夹
  4. Create a testsuite file in the "Testsuites" folder (f.ex "01_testsuite.robot") 在“ Testsuites”文件夹中创建一个测试套件文件(f.ex“ 01_testsuite.robot”)
  5. Copypaste your imported code from katalon recorder to this testuite file 将导入的代码从katalon记录器复制粘贴到此testuite文件中
  6. Create "seleniumLibrary.robot" file in the resources folder. 在资源文件夹中创建“ seleniumLibrary.robot”文件。
  7. Copy paste this code in the file. 复制后将此代码粘贴到文件中。 Note the Library line in the beginning of the file. 注意文件开头的“ 库”行。
  8. Open the project folder in RIDE 在RIDE中打开项目文件夹
  9. If your development environment has been setup correctly you should be able to run your testsuite and/or testcase with RIDE. 如果您的开发环境已正确设置,则您应该能够使用RIDE运行测试套件和/或测试用例。

Try to remove that resource line in the code and change it to Library Selenium2Library. 尝试在代码中删除该资源行,并将其更改为Library Selenium2Library。 I think the issue is that katalon studio is generating a code that uses seleniumlibrary. 我认为问题在于katalon studio正在生成使用seleniumlibrary的代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM