问题
I want to use robot framework with java in Eclipse IDE. i have installed robot framework in Eclipse IDE. How to write script by using robot framework with Selenium web-driver.
回答1:
If you want to use eclipse as an IDE to write your tests you can use this plugin:
RobotFramework-EclipseIDE
If your goal is to write a java method then call it from robotframework you can use Remote library.
Here are the supported formats writing robotium tests: Robotium Test Data Sytntax
You can also use maven to run robotframework test from maven project in eclipse: Robotframework Maven plugin
回答2:
If you want to write user defined keywords in java which can be used in robot script, import "AnnotationLibrary".
Link is mentioned below and follow the steps
https://github.com/robotframework/JavalibCore/wiki/AnnotationLibrary
回答3:
try this way. i am using python language to write test case. python is best way to write a test cases.
my test case file name is test_google_page.robot put this code to test_google_page.robot file and save it. next open command line and go to test_google_page.robot file path and run this command
[user@localhost google_test]$ pybot test_google_page.robot
then you can seen your test case result.
*** Settings ***
Documentation your document
Library Selenium2Library
*** Variables ***
${Url} https://www.google.lk
${Browser} chrome
${Delay} 3s
*** Test Cases ***
load google page
[Documentation] your test case document
OPEN BROWSER ${Url} ${Browser}
Input text id=lst-ib robot framework
sleep ${Delay}
# click button id=<button_id>
# Page Should Contain loglevel=INFO text=<content>
Capture Page Screenshot filename=test_result.png
[Teardown] CLOSE BROWSER
来源:https://stackoverflow.com/questions/21670982/selenium-webdriver-how-to-use-robot-framework-with-java