robot framework + selenium2-- window and simple button operation input box

 

open browser Keywords: Open your browser


close browser Keywords: close your browser


close all browsers Keywords: Quit all


close window Keywords: close the current window does not need to receive any parameters


go back Keywords: simulation browser back. It does not require any parameters


reload page Keywords: refresh the current page does not require any parameters


go to Keyword: simulation of the browser forward. Needs to receive a [url] Parameter


get location Keywords: get the current window to access the page does not need to receive any path parameters


get window position Keywords: get the coordinates of the location of the current page window, and then return to first return to the abscissa ordinate not need to receive any parameters


get window size Keywords: Gets the current page size of the window, to return to the wide window, and then return to the window of the high need not receive any parameters


get title Keywords: Get the title of the browser page without any parameters.


get window titles Keyword: Get all title currently open browser window does not require any parameters.


========================================================================================================================
=========================================================================================================================
==========================================================================================================================


clear element text Keywords: empty the contents of the text box receives a keyword parameter [locator], can be positioned by id, name, xpath like


Keyword input password: similar keyword input text, for entering the password, the display is not receiving two parameters log [Locator | text]. text represents the password entered


input text Keywords: Analog input into a text input box. Receiving two parameters [Locator | text]. Enter the text content of text on behalf of the


click button: Keywords: Analog click the button page. Receiving a keyword parameter [locator], can be positioned by id, name, xpath like


click element Keywords: Analog Click to locate a specific element. Receiving a keyword parameter [locator], can be positioned by id, name, xpath like


click image Keywords: Analog click an image or the keyword receives a parameter [locator], can be positioned by id, name, xpath, etc.


click link Keywords: Analog click a link. Receiving a keyword parameter [locator], can be positioned by id, name, xpath like


get all links Keywords: used to get all the elements href link id for the page, and then replaced with an empty string when there is no corresponding id


choose file Keywords: used to complete the file upload. Receiving two parameters: the path input box is positioned and a long pass file path. The keyword receives two parameters [Locator | file_path]


get text Keywords: Get the text content of the element. Receiving a keyword parameter [locator], can be positioned by id, name, xpath like


GET key value: Get value of an element corresponding to the tag value attribute of the keyword receiving a parameter [locator], can be positioned by id, name, xpath like

 

===========================================================================================================================
open browser 、close browser、clear element text 、input text、click button :关键字


Browser HTTP Open: // www.baidu.com Chrome 

the Clear Element text the above mentioned id = kw                                                                                 // clear the text box 

the INPUT text the above mentioned id = kw Robot Framework                                             // input text 

the Click the Button the above mentioned id = su                                                                               // simulate clicking a button

close browser


==============================================================================================================================

go back, go to 关键 character:


open browser                                  http://www.baidu.com                               chrome

click link News

${title2}                                     get window titles

log                                           ${title2}

go back

${title3}                                     get window titles

log                                           ${title3}

go to                                         https://www.cnblogs.com/

${title4}                                     get window titles

log                                           ${title4}

close all browsers

 

=========================================================================================================================
click element: Keyword

Browser HTTP Open: // www.baidu.com Chrome 

the INPUT text the above mentioned id = kw Robot Framework        // input text 

the Click Element the above mentioned id = su                                                               // simulate clicking a specific element

close browser


============================================================================================================================
click link: Keyword

Browser HTTP Open: // www.baidu.com Chrome 

the Click Link HTTP: // map.baidu.com                                            // simulate a click connection

close browser


-----------------------------------------------------------------------------------------------------------------------------------
click link: Keyword

Browser HTTP Open: // www.baidu.com Chrome 

the Click Link name = tj_trmap                                                        // simulate a click connection 

SLEEP                                       2

close browser


======================================================================================================================
get all links: Keyword

open browser                         http://www.baidu.com                           chrome

${links}                             get all links

log ${links}

sleep                                2

close browser


======================================================================================================================
choose file: Keyword

Browser HTTP Open: // www.baidu.com Chrome 

the Click Element                                 // * [the above mentioned id = 'form'] / span [1] / span                                   // camera icon, click the button next to the input box 

SLEEP                                         10

choose file                                  //*[id='form']/div/div[2]/div[2]/input             E:\\xxx.png

close browser


=========================================================================================================================
get text: Keyword

Browser HTTP Open: // www.baidu.com Chrome 

$ {text} GET text name = tj_trnews           // here is the name to locate the 

log $ {text}                                                               // prints out: Press 

SLEEP                                   2

close browser


-------------------------------------------------------------------------------------------------------------------------
get text: Keyword

Browser HTTP Open: // www.baidu.com Chrome 

$ {text} GET text                           // * [@ ID = 'UL'] / A [. 1]                 // here xpath to locate the 

log {text} $                                                              / / print out: Press 

SLEEP 2

close browser


==============================================================================================================================
get title: Keyword

Browser HTTP Open: // www.baidu.com Chrome 

$ {title} title GET                                                    // get the browser page title 

log $ {title}                                                    // prints out: Baidu some of the, you know 

SLEEP                                       2

close browser


=============================================================================================================================

get value: Keyword


Browser HTTP Open: // www.baidu.com Chrome 

$ {value} value GET ID = signin      // Get the value of the property tag corresponding to an element

log                               ${value}

sleep                             2

close browser


==================================================================================================================


get window titles: Keyword

open browser                     http://www.baidu.com                         chrome

click link News

${titles}                        get window titles

log                              ${titles}

sleep                            2

close all browsers


=====================================================================================================================


get location: Keyword

open browser                   http://www.baidu.com                             chrome

${location}                    get location

log                            ${location}

sleep                          2

close browser


============================================================================================================================

get window position Keywords:


open browser                   http://www.baidu.com                   chrome

${x}                           ${y}                                   get window position

log                            ${x}

log                            ${y}

close browser


===========================================================================================================================

get window size Keywords:


open browser                       http://www.baidu.com                     chrome

${width}                           ${height}                                get window size

log                                ${width}

log                                ${height}

close browser


==========================================================================================================================

 

 

 

 

Guess you like

Origin www.cnblogs.com/xiaobaibailongma/p/12333894.html