77 get_body_text(self)
Gets the entire text of the page.
得到当前页面的文本。
Translator: | Chip |
---|---|
Date: | 2011-08-01 |
INDEX
Clicks on a link, button, checkbox or radio button. If the click action causes a new page to load (like a link usually does), call waitForPageToLoad. 'locator' is an element locator
-点击一个连接、按钮、勾选框或者单选按钮。如果点击事件会造成新页面的加载,则会调用waitForPageToLoad。‘locator’是指元素定位器
Double clicks on a link, button, checkbox or radio button. If the double click action causes a new page to load (like a link usually does), call waitForPageToLoad. 'locator' is an element locator
双击一个连接、按钮、勾选框或者单元按钮。如果双击事件会造成新页面的加载,则会调用waitForPageToLoad。‘locator’是指元素定位器
Clicks on a link, button, checkbox or radio button. If the click action causes a new page to load (like a link usually does), call waitForPageToLoad. 'locator' is an element locator 'coordString' is specifies the x,y position (i.e. 10,20) of the mouse event relative to the element returned by the locator.
点击一个连接、按钮、勾选框或者单选按钮。如果点击事件会造成新页面的加载,则会调用waitForPageToLoad。‘coordString’是由定位器返回的元素鼠标事件的相对x,y坐标
Doubleclicks on a link, button, checkbox or radio button. If the action causes a new page to load (like a link usually does), call waitForPageToLoad. 'locator' is an element locator 'coordString' is specifies the x,y position (i.e. 10,20) of the mouse event relative to the element returned by the locator.
同上,只是双击。
Explicitly simulate an event, to trigger the corresponding "onevent" handler. 'locator' is an element locator 'eventName' is the event name, e.g. "focus" or "blur"
显示的模拟事件发生,调用事件响应“onevent” handler。
Move the focus to the specified element; for example, if the element is an input field, move the cursor to that field. 'locator' is an element locator
转移焦点到指定的元素。比如:使光标到指定的输入框。
Simulates a user pressing and releasing a key. 'locator' is an element locator 'keySequence' is Either be a string("" followed by the numeric keycode of the key to be pressed, normally the ASCII value of that key), or a single character. For example: "w", " 9".
模拟用户压下与释放按键。 'keySequence' 可以是一个字符串(要按下的键的ASCII值,比如"\13"),也可以是单独的字母,比如"w"
Press the shift key and hold it down until doShiftUp() is called or a new page is loaded.
模拟按下shift键,并且保持按下,直到调用 doShiftUp(),或者一个新的页面被加载。
Press the meta key and hold it down until doMetaUp() is called or a new page is loaded.
模拟按下复合键,并且保持按下,直到调用doMetaUp(),或者一个新的页面被加载。
Press the alt key and hold it down until doAltUp() is called or a new page is loaded.
按下alt键,直到doAltUp()被调用或者新的页面被加载。
Press the control key and hold it down until doControlUp() is called or a new page is loaded.
按下control键直到doControlUp()被调用,或者新的页面被加载。
Simulates a user pressing a key (without releasing it yet). 'locator' is an element locator 'keySequence' is Either be a string("" followed by the numeric keycode of the key to be pressed, normally the ASCII value of that key), or a single character. For example: "w", " 9".
模拟用户按下某个键(不释放)。
Simulates a user releasing a key. 'locator' is an element locator 'keySequence' is Either be a string("" followed by the numeric keycode of the key to be pressed, normally the ASCII value of that key), or a single character. For example: "w", " 9".
模拟用户释放某个键。
Simulates a user hovering a mouse over the specified element. 'locator' is an element locator
模拟用户鼠标徘徊在某个特定元素。
Simulates a user moving the mouse pointer away from the specified element. 'locator' is an element locator
模拟用户移动鼠标指针离开某个元素。
Simulates a user pressing the left mouse button (without releasing it yet) on the specified element. 'locator' is an element locator
模拟用户在某元素上按下鼠标左键(而不释放)。
Simulates a user pressing the right mouse button (without releasing it yet) on the specified element. 'locator' is an element locator
模拟用户在某元素上按下鼠标右键(而不释放)。
Simulates a user pressing the left mouse button (without releasing it yet) at the specified location. 'locator' is an element locator 'coordString' is specifies the x,y position (i.e. 10,20) of the mouse event relative to the element returned by the locator.
加入了相对坐标的mouse_down。
Simulates a user pressing the right mouse button (without releasing it yet) at the specified location. 'locator' is an element locator 'coordString' is specifies the x,y position (i.e. 10,20) of the mouse event relative to the element returned by the locator.
加入了相对坐标的mouse_down_right。
Simulates the event that occurs when the user releases the mouse button (i.e., stops holding the button down) on the specified element. 'locator' is an element locator
模拟用户在某个元素上释放鼠标。
Simulates the event that occurs when the user releases the right mouse button (i.e., stops holding the button down) on the specified element. 'locator' is an element locator
模拟用户在某个元素上释放鼠标右键。
Simulates the event that occurs when the user releases the mouse button (i.e., stops holding the button down) at the specified location. 'locator' is an element locator 'coordString' is specifies the x,y position (i.e. 10,20) of the mouse event relative to the element returned by the locator.
加入了相对坐标的mouse_up。
Simulates the event that occurs when the user releases the right mouse button (i.e., stops holding the button down) at the specified location. 'locator' is an element locator 'coordString' is specifies the x,y position (i.e. 10,20) of the mouse event relative to the element returned by the locator.
加了相对坐标的mouse_up_right
Simulates a user pressing the mouse button (without releasing it yet) on the specified element. 'locator' is an element locator
模拟用户在特定元素上按下鼠标(不释放)。
Simulates a user pressing the mouse button (without releasing it yet) on the specified element. 'locator' is an element locator 'coordString' is specifies the x,y position (i.e. 10,20) of the mouse event relative to the element returned by the locator.
加了相对坐标的mouse_move_at
Sets the value of an input field, as though you typed it in. Can also be used to set the value of combo boxes, check boxes, etc. In these cases, value should be the value of the option selected, not the visible text. 'locator' is an element locator 'value' is the value to type
模拟用户输入一样在输入框中输入内容。 也可以用于设置下拉框、勾选框等的值。在上述情况下,值应该是选项的值,而不是显示的文本。
Simulates keystroke events on the specified element, as though you typed the value key-by-key. This is a convenience method for calling keyDown, keyUp, keyPress for every character in the specified string; this is useful for dynamic UI widgets (like auto-completing combo boxes) that require explicit key events. Unlike the simple "type" command, which forces the specified value into the page directly, this command may or may not have any visible effect, even in cases where typing keys would normally have a visible effect. For example, if you use "typeKeys" on a form element, you may or may not see the results of what you typed in the field. In some cases, you may need to use the simple "type" command to set the value of the field and then the "typeKeys" command to send the keystroke events corresponding to what you just typed. 'locator' is an element locator 'value' is the value to type
模拟用户在元素上连续的敲击按键。 这算是为每个字符调用keyDown, keyUp, keyPress以输出字符串的简便方法。这对于一些需要显示调用按键时间的动态UI控件非常有用。 不同于简单的type命令的是,这个命令执行时可能会有可视化的效果。 在一些情况下,你可能需要使用type命令去设置一个域的值,然后调用typeKeys命令来对你刚键入的值进行敲击时间响应。
Set execution speed (i.e., set the millisecond length of a delay which will follow each selenium operation). By default, there is no such delay, i.e., the delay is 0 milliseconds. 'value' is the number of milliseconds to pause after operation
设置每条语句执行的间隔时间(微秒),默认没有任何延迟。
Get execution speed (i.e., get the millisecond length of the delay following each selenium operation). By default, there is no such delay, i.e., the delay is 0 milliseconds. See also setSpeed.
获取每条语句执行的间隔时间(微秒)
Check a toggle-button (checkbox/radio) 'locator' is an element locator
勾选一个开关按钮(勾选框/单选框)
Uncheck a toggle-button (checkbox/radio) 'locator' is an element locator
去除勾选一个开关按钮
Select an option from a drop-down using an option locator. Option locators provide different ways of specifying options of an HTML Select element (e.g. for selecting a specific option, or for asserting that the selected option satisfies a specification). There are several forms of Select Option Locator. • label=labelPattern: matches options based on their labels, i.e. the visible text. (This is the default.) ○ label=regexp:^[Oo]ther • value=valuePattern: matches options based on their values. ○ value=other • id=id: matches options based on their ids. ○ id=option1 • index=index: matches an option based on its index (offset from zero). ○ index=2 If no option locator prefix is provided, the default behaviour is to match on label. 'selectLocator' is an element locator identifying a drop-down menu 'optionLocator' is an option locator (a label by default)
选中一个下拉框的选项。 OptionLocators 提供了不同的方法用于定位一个html选择元素的选项。 以下是OptionLocator的几种格式: ○ label=labelPattern: 根据label来匹配选项(默认)。 § label=regexp: ^[Oo]ther ○ value=valuePattern: 根据值来匹配选项 § value=other ○ id=id: 根据IDs来匹配选项 § id=option1 ○ index=index: 根据序号来匹配选项(从0起) § index=2 如果没有提供选项定位器,默认的行为是匹配label。
Add a selection to the set of selected options in a multi-select element using an option locator. @see #doSelect for details of option locators 'locator' is an element locator identifying a multi-select box 'optionLocator' is an option locator (a label by default)
为多选元素添加被选中的选项。
Remove a selection from the set of selected options in a multi-select element using an option locator. @see #doSelect for details of option locators 'locator' is an element locator identifying a multi-select box 'optionLocator' is an option locator (a label by default)
去除多选元素中的选项。
Unselects all of the selected options in a multi-select element. 'locator' is an element locator identifying a multi-select box
移除所有的多选元素的选项。
Submit the specified form. This is particularly useful for forms without submit buttons, e.g. single-input "Search" forms. 'formLocator' is an element locator for the form you want to submit
提交表单。这对于没有提交按钮的表单尤其有用,比如:单一输入的“搜索”表单。
Opens an URL in the test frame. This accepts both relative and absolute URLs. The "open" command waits for the page to load before proceeding, ie. the "AndWait" suffix is implicit. Note: The URL must be on the same domain as the runner HTML due to security restrictions in the browser (Same Origin Policy). If you need to open an URL on another domain, use the Selenium Server to start a new browser session on that domain. 'url' is the URL to open; may be relative or absolute
在测试框架中打开一个URL(绝对 or 相对) open命令会等待页面加载后才进入下一步处理,相当于隐式的调用了"AndWait"。 提示:作为参数的URL必须与runner HTML具有相同的域名(由于浏览器的“同源策略”的安全限制)。如果你想要打开另一个域名的URL,可以利用selenium server来启动一个新的浏览器会话。
Opens a popup window (if a window with that ID isn't already open). After opening the window, you'll need to select it using the selectWindow command. This command can also be a useful workaround for bug SEL-339. In some cases, Selenium will be unable to intercept a call to window.open (if the call occurs during or before the "onLoad" event, for example). In those cases, you can force Selenium to notice the open window's name by using the Selenium openWindow command, using an empty (blank) url, like this: openWindow("", "myFunnyWindow"). 'url' is the URL to open, which can be blank 'windowID' is the JavaScript window ID of the window to select
打开一个弹出窗口(如果相同ID的窗口不存在)。打开窗口后,可以通过调用selectWindow命令来选中它。 该命令同样可以用于避开bug SEL-339。在某些情况下,selenium无法拦截window.open指令(比如,该调用发生在onLoad时间发生时或者发生前)。在那些情况下,你可以强迫selenium使用openWindow命令来选中已打开的窗口,使用空白的url,比如openWindow("", "myFunnyWindow")。
Selects a popup window using a window locator; once a popup window has been selected, all commands go to that window. To select the main window again, use null as the target. Window locators provide different ways of specifying the window object: by title, by internal JavaScript "name," or by JavaScript variable. • title=My Special Window: Finds the window using the text that appears in the title bar. Be careful; two windows can share the same title. If that happens, this locator will just pick one. • name=myWindow: Finds the window using its internal JavaScript "name" property. This is the second parameter "windowName" passed to the JavaScript method window.open(url, windowName, windowFeatures, replaceFlag) (which Selenium intercepts). • var=variableName: Some pop-up windows are unnamed (anonymous), but are associated with a JavaScript variable name in the current application window, e.g. "window.foo = window.open(url);". In those cases, you can open the window using "var=foo". If no window locator prefix is provided, we'll try to guess what you mean like this: 1.) if windowID is null, (or the string "null") then it is assumed the user is referring to the original window instantiated by the browser). 2.) if the value of the "windowID" parameter is a JavaScript variable name in the current application window, then it is assumed that this variable contains the return value from a call to the JavaScript window.open() method. 3.) Otherwise, selenium looks in a hash it maintains that maps string names to window "names". 4.) If that fails, we'll try looping over all of the known windows to try to find the appropriate "title". Since "title" is not necessarily unique, this may have unexpected behavior. If you're having trouble figuring out the name of a window that you want to manipulate, look at the Selenium log messages which identify the names of windows created via window.open (and therefore intercepted by Selenium). You will see messages like the following for each window as it is opened: debug: window.open call intercepted; window ID (which you can use with selectWindow()) is "myNewWindow" In some cases, Selenium will be unable to intercept a call to window.open (if the call occurs during or before the "onLoad" event, for example). (This is bug SEL-339.) In those cases, you can force Selenium to notice the open window's name by using the Selenium openWindow command, using an empty (blank) url, like this: openWindow("", "myFunnyWindow"). 'windowID' is the JavaScript window ID of the window to select
根据window定位器选中一个弹出窗口;一旦弹出窗口被选中,所有的命令都会在此窗口中执行。如果想再次选中主窗口,请使用null作为目标窗口。 可以通过多种方式来确定一个window定位器:标题,内部JavaScript "name",或者JavaScript变量。 ○ title=My Special Window:通过显示在标题栏的文本来定位窗口。如果两个window使用同一个标题,那么定位器会随机挑选一个。 ○ name=myWindow:使用内部JavaScript "name"属性来定位窗口。即JavaScript方法window.open(url, windowName, windowFeatures, replaceFlag)中的第二个传入参数。 ○ var=variableName:有些弹出窗口时匿名的,但可以通过当前应用窗口的JavaScript变量来定位,比如:"window.foo=window.open(url);"。这些情况下,你可以使用"var=foo"来打开窗口。 如果没有提供窗口定位器前缀,我们就会试着去猜: ○ 如果windowID为空(或字符串"null"),那么selenium就会认为用户指的是被浏览器实例化的原始窗口。 ○ 如果windowID参数的值,是当前应用窗口中JavaScript的变量名,selenium就会认为这个变量包含的是调用JavaScript的window.open()方法的返回值。 ○ 否则得话,selenium去它维护的一张字符串名映射window "names"的哈希表中去查找。 ○ 如果以上都失败,selenium就会遍历所有已知的windows,来找寻合适的“标题”。由于“标题”`不是唯一的,所以这会造成不可知的行为。 如果你不知道如何获得你想要控制的窗口的名称,那就去看看selenium的日志信息,这些日志是selenium用于区分由window.open创建的窗口(然后拦截)的名称的。你会看到每个窗口打开是产生的类似如下的信息: debug: window.open call intercepted; window ID (which you can use with selectWindow()) is "myNewWindow" 在某些情况下,selenium无法拦截window.open指令(比如,该调用发生在onLoad时间发生时或者发生前,bug SEL-339)。在那些情况下,你可以强迫selenium使用openWindow命令来选中已打开的窗口,使用空白的url,比如openWindow("", "myFunnyWindow")
Simplifies the process of selecting a popup window (and does not offer functionality beyond what selectWindow() already provides). • If windowID is either not specified, or specified as "null", the first non-top window is selected. The top window is the one that would be selected by selectWindow() without providing a windowID . This should not be used when more than one popup window is in play. • Otherwise, the window will be looked up considering windowID as the following in order: 1) the "name" of the window, as specified to window.open(); 2) a javascript variable which is a reference to a window; and 3) the title of the window. This is the same ordered lookup performed by selectWindow . 'windowID' is an identifier for the popup window, which can take on a number of different meanings
简化选择一个弹出窗口的过程(不提供比selectWindow()更多的功能) ○ 如果windowID要么没有指定,要么指定为"null",那么第一个非顶层的窗口将被选中。顶层窗口是当selectWindow没有提供任何windowID时被选中的那个窗口。此方法在存在多余一个弹出窗口时不应该被使用。 ○ 否则,windowID就会以以下顺序被查询:1)由window.open()指定的窗口的"name";2)一个指向某个窗口的JavaScript变量;3)窗口的标题。这与selectWindow查询的顺序是一致的。
Selects the main window. Functionally equivalent to using selectWindow() and specifying no value for windowID.
选择主窗口。功能上与不指定windowID的值时调用selectWindow()等效。
Selects a frame within the current window. (You may invoke this command multiple times to select nested frames.) To select the parent frame, use "relative=parent" as a locator; to select the top frame, use "relative=top". You can also select a frame by its 0-based index number; select the first frame with "index=0", or the third frame with "index=2". You may also use a DOM expression to identify the frame you want directly, like this: dom=frames["main"].frames["subframe"] 'locator' is an element locator identifying a frame or iframe
选中一个当前窗口中的frame。(你可以通过多次调用这个方法来选择嵌入的frame)使用"relative=parent"作为locator来选中parent frame。使用"relative=top"来选中top frame。你也可以通过由0开始计数的序列号来选中一个frame。 你也可以通过使用DOM表达式来直接指定将要选中的frame,比如: dom=frames["main"].frames["subframe"]
Determine whether current/locator identify the frame containing this running code. This is useful in proxy injection mode, where this code runs in every browser frame and window, and sometimes the selenium server needs to identify the "current" frame. In this case, when the test calls selectFrame, this routine is called for each frame to figure out which one has been selected. The selected frame will return true, while all others will return false. 'currentFrameString' is starting frame 'target' is new frame (which might be relative to the current one)
判断当前(or 定位器)是否识别包含执行代码的frame。 此方法可用于代理注入模式,在这种模式下代码可以在每一个浏览器的frame与窗口中执行,有时selenium server需要定位“当前的”frame。在这种情况下,当测试调用selectFrame时,此程序就会被调用,用来确定哪一个frame是被选中的。被选中的frame会返回true,其余的则会返回false。 'currentFrameString'是启动frame,'target'是新开frame(可能与当前窗口有关联)。
Determine whether currentWindowString plus target identify the window containing this running code. This is useful in proxy injection mode, where this code runs in every browser frame and window, and sometimes the selenium server needs to identify the "current" window. In this case, when the test calls selectWindow, this routine is called for each window to figure out which one has been selected. The selected window will return true, while all others will return false. 'currentWindowString' is starting window 'target' is new window (which might be relative to the current one, e.g., "_parent")
判断 currentWindowString + target 是否识别包含执行代码的窗口。 此方法可用于代理注入模式,在这种模式下代码可以在每一个浏览器的frame与窗口中执行,有时selenium server需要定位“当前的”window。在这种情况下,当测试调用selectWindow时,此程序就会被调用,用来确定哪一个window是被选中的。被选中的window会返回true,其余的则会返回false。 'currentWindowString'是启动窗口,'target'是新开窗口(可能与当前窗口有关联,比如"_parent")。
Waits for a popup window to appear and load up. 'windowID' is the JavaScript window "name" of the window that will appear (not the text of the title bar) If unspecified, or specified as "null", this command will wait for the first non-top window to appear (don't rely on this if you are working with multiple popups simultaneously). 'timeout' is a timeout in milliseconds, after which the action will return with an error. If this value is not specified, the default Selenium timeout will be used. See the setTimeout() command.
等待弹出窗口显示并加载。 如果没有指定给的话,'windowID'是将要弹出的窗口的JavaScript窗口的'name'值,或者指定为'null',这个指令将会等待第一个非顶层窗口出现(当多个弹出窗口同时存在是,就不要依赖这个方法了)。
By default, Selenium's overridden window.confirm() function will return true, as if the user had manually clicked OK; after running this command, the next call to confirm() will return false, as if the user had clicked Cancel. Selenium will then resume using the default behavior for future confirmations, automatically returning true (OK) unless/until you explicitly call this command for each confirmation. Take note every time a confirmation comes up, you must consume it with a corresponding getConfirmation, or else the next selenium operation will fail.
默认情况下,selenium被重载的函数window.confirm()会返回true,行为如同用户手动点击了OK;执行此命令后,下一次调用confirm()就会返回false,如同用户点击了cancel。selenium对于接下来的确认恢复使用默认行为,除非你显示地调用此命令来处理每一次确认,否则将会自动地返回true(OK)。 注意:每次确认,你都需要用相应的getConfirmation来干掉它,否则下一个selenium操作就会失败。
Undo the effect of calling chooseCancelOnNextConfirmation. Note that Selenium's overridden window.confirm() function will normally automatically return true, as if the user had manually clicked OK, so you shouldn't need to use this command unless for some reason you need to change your mind prior to the next confirmation. After any confirmation, Selenium will resume using the default behavior for future confirmations, automatically returning true (OK) unless/until you explicitly call chooseCancelOnNextConfirmation for each confirmation. Take note every time a confirmation comes up, you must consume it with a corresponding getConfirmation, or else the next selenium operation will fail.
撤销调用chooseCancelOnNextConfirmation的效果。selenium重载的函数window.confirm()正常情况下会自动返回true,行为如同用户手动点击OK,所以除非你需要该表下一次确认的优先级,否则你没有必要调用此指令。在确认过之后,selenium将对接下来的确认执行默认操作,自动返回true(OK),除非(直到)你为每一次确认显示地调用chooseCancelOnNextConfirmation。
Instructs Selenium to return the specified answer string in response to the next JavaScript prompt [window.prompt()]. 'answer' is the answer to give in response to the prompt pop-up
指示selenium为下一次JavaScript提示[window.prompt()]返回指定的应答字符串。
Simulates the user clicking the "Refresh" button on their browser.
模拟用户点击浏览器的“刷新”按钮。
Simulates the user clicking the "close" button in the titlebar of a popup window or tab.
模拟用户点击弹出框或者页签的“关闭”按钮。
Has an alert occurred? This function never throws an exception
判断是否出现过警告。 这个函数不会抛出任何异常。
Has a prompt occurred? This function never throws an exception
判断是否出现过提示框。 这个函数不会抛出任何异常。
Has confirm() been called? This function never throws an exception
判断confirm()是否被调用过。 这个函数不会抛出任何异常。
Retrieves the message of a JavaScript alert generated during the previous action, or fail if there were no alerts. Getting an alert has the same effect as manually clicking OK. If an alert is generated but you do not consume it with getAlert, the next Selenium action will fail. Under Selenium, JavaScript alerts will NOT pop up a visible alert dialog. Selenium does NOT support JavaScript alerts that are generated in a page's onload() event handler. In this case a visible dialog WILL be generated and Selenium will hang until someone manually clicks OK.
返回上一个动作产生的JavaScript警告信息,如果没有警告则失败。 获得警告与手动点击OK有相同的效果。如果警告框没有被getAlert关掉,下一个Selenium行为就会失败。 使用Selenium时,JavaScript不会弹出可见的警告对话框。 Selenium不支持页面onload事件触发的JavaScript警告。这种情况下,可见的对话框如果弹出,selenium将会挂起,直到有人手动点击OK。
Retrieves the message of a JavaScript confirmation dialog generated during the previous action. By default, the confirm function will return true, having the same effect as manually clicking OK. This can be changed by prior execution of the chooseCancelOnNextConfirmation command. If an confirmation is generated but you do not consume it with getConfirmation, the next Selenium action will fail. NOTE: under Selenium, JavaScript confirmations will NOT pop up a visible dialog. NOTE: Selenium does NOT support JavaScript confirmations that are generated in a page's onload() event handler. In this case a visible dialog WILL be generated and Selenium will hang until you manually click OK.
获得上一个动作产生的JavaScript确认对话框的信息. 默认情况下,确认函数会返回true,如同手动点击OK的效果。这个效果可以被优先级更高的chooseCancelOnNextConfirmation()命令的执行所改变。 如果产生了确认框,但是你又没有手动点击掉它,那写一个selenium操作将会失败。
Retrieves the message of a JavaScript question prompt dialog generated during the previous action. Successful handling of the prompt requires prior execution of the answerOnNextPrompt command. If a prompt is generated but you do not get/verify it, the next Selenium action will fail. NOTE: under Selenium, JavaScript prompts will NOT pop up a visible dialog. NOTE: Selenium does NOT support JavaScript prompts that are generated in a page's onload() event handler. In this case a visible dialog WILL be generated and Selenium will hang until someone manually clicks OK.
获得上一个行为产生的JavaScript问题提示对话框信息。对提示对话框的handling是否成功,取决于answerOnNextPrompt命令优先执行的是否成功。如果提示对话框产生但你没有得到(验证)它,下一个selenium行为就会失败。
Gets the (whitespace-trimmed) value of an input field (or anything else with a value parameter). For checkbox/radio elements, the value will be "on" or "off" depending on whether the element is checked or not. 'locator' is an element locator
得到具有value属性的指定控件的值。对于checkbox/radio控件,根据该控件选中与否,值为'on' or 'off'。
Gets the text of an element. This works for any element that contains text. This command uses either the textContent (Mozilla-like browsers) or the innerText (IE-like browsers) of the element, which is the rendered text shown to the user. 'locator' is an element locator
得到具有text属性的指定控件的文本信息。
Briefly changes the backgroundColor of the specified element yellow. Useful for debugging. 'locator' is an element locator
简要的将选中的控件的背景色改为黄色。在debug的时候很有用。
Gets the result of evaluating the specified JavaScript snippet. The snippet may have multiple lines, but only the result of the last line will be returned. Note that, by default, the snippet will run in the context of the "selenium" object itself, so this will refer to the Selenium object. Use window to refer to the window of your application, e.g. window.document.getElementById('foo') If you need to use a locator to refer to a single element in your application page, you can usethis.browserbot.findElement("id=foo") where "id=foo" is your locator. 'script' is the JavaScript snippet to run
获得指定JavaScript片段的评估结果。片段可能有多行,但只有最后一行的结果会被返回。 注意:默认情况下,片段会运行在selenium对象自身的上下文中,所以这会参考到selenium对象。使用窗口来指向你应用程序的窗口,e.g. window.document.getElementById('foo')。 如果你需要使用定位器指定你页面内的单个元素,你可以使用 this.browserbot.findElement('id=foo'), 其中'id=foo'就是你的定位器。
Gets whether a toggle-button (checkbox/radio) is checked. Fails if the specified element doesn't exist or isn't a toggle-button. 'locator' is an element locator pointing to a checkbox or radio button
获得一个开关按钮(checkbox/radio)是否被选中。如果指定的控件,或者开关按钮不存在,则返回失败。 定位器是指向checkbox与单选按钮的控件定位器。
Gets the text from a cell of a table. The cellAddress syntax tableLocator.row.column, where row and column start at 0. 'tableCellAddress' is a cell address, e.g. "foo.1.4"
Gets all option labels (visible text) for selected options in the specified select or multi-select element. 'selectLocator' is an element locator identifying a drop-down menu
获得指定的选择(多选)框的被选中内容的标签(可见文本)。
Gets option label (visible text) for selected option in the specified select element. 'selectLocator' is an element locator identifying a drop-down menu
获得选择框中选中内容的标签。
Gets all option values (value attributes) for selected options in the specified select or multi-select element. 'selectLocator' is an element locator identifying a drop-down menu
获得选择框或多选框中被选中内容的值。
Gets option value (value attribute) for selected option in the specified select element. 'selectLocator' is an element locator identifying a drop-down menu
获得选择框中被选中内容的值。
Gets all option indexes (option number, starting at 0) for selected options in the specified select or multi-select element. 'selectLocator' is an element locator identifying a drop-down menu
获得选择框(多选框)中指定选项的索引。
Gets option index (option number, starting at 0) for selected option in the specified select element. 'selectLocator' is an element locator identifying a drop-down menu
Gets all option element IDs for selected options in the specified select or multi-select element. 'selectLocator' is an element locator identifying a drop-down menu
获得下拉菜单中被选中的元素的ID。
Gets option element ID for selected option in the specified select element. 'selectLocator' is an element locator identifying a drop-down menu
Determines whether some option in a drop-down menu is selected. 'selectLocator' is an element locator identifying a drop-down menu
判断是否下拉菜单中有选项被选中。
Gets all option labels in the specified select drop-down. 'selectLocator' is an element locator identifying a drop-down menu
获得下拉菜单中所有选项的标签。
Gets the value of an element attribute. The value of the attribute may differ across browsers (this is the case for the "style" attribute, for example). 'attributeLocator' is an element locator followed by an @ sign and then the name of the attribute, e.g. "foo@bar"
获得一个元素属性的值。此属性值可能由于不同浏览器而不同,比如‘style’属性。 'attributeLocator' 是元素定位器,其后跟着@符号和属性的名称。
Verifies that the specified text pattern appears somewhere on the rendered page shown to the user. 'pattern' is a pattern to match with the text of the page
验证给定的文本模式是否存在于呈现给用户的被渲染的页面中。
Verifies that the specified element is somewhere on the page. 'locator' is an element locator
验证给定的元素在是否在页面中。
Determines if the specified element is visible. An element can be rendered invisible by setting the CSS "visibility" property to "hidden", or the "display" property to "none", either for the element itself or one if its ancestors. This method will fail if the element is not present. 'locator' is an element locator
判断给定的元素是否是可见的。元素可以通过在CSS的'visibility'属性中设置'hidden',或者'display'属性设置'none',被设置为不可见,无论是元素资深还是它的祖先。如果此元素不存在则方法返回失败。
Determines whether the specified input element is editable, ie hasn't been disabled. This method will fail if the specified element isn't an input element. 'locator' is an element locator
判断给定的输入元素是否可以编辑。如果给定元素不是输入元素,则方法失败。
Returns the IDs of all buttons on the page. If a given button has no ID, it will appear as "" in this array.
返回页面上所有按钮的ID。 如果给定的按钮没有ID,则数组中该ID显示为""。
Returns the IDs of all links on the page. If a given link has no ID, it will appear as "" in this array.
返回页面上所有链接的ID。 如果没有ID,则显示""。
Returns the IDs of all input fields on the page. If a given field has no ID, it will appear as "" in this array.
返回页面上所有输入域的ID。
Returns every instance of some attribute from all known windows. 'attributeName' is name of an attribute on the windows
返回所有已知窗口中某一属性的实例。
deprecated use dragAndDrop instead 'locator' is an element locator 'movementsString' is offset in pixels from the current location to which the element should be moved, e.g., "+70,-300"
反对使用, 使用 dragAndDrop。
Configure the number of pixels between "mousemove" events during dragAndDrop commands (default=10). Setting this value to 0 means that we'll send a "mousemove" event to every single pixel in between the start location and the end location; that can be very slow, and may cause some browsers to force the JavaScript to timeout. If the mouse speed is greater than the distance between the two dragged objects, we'll just send one "mousemove" at the start location and then one final one at the end location. 'pixels' is the number of pixels between "mousemove" events
设置dragAndDrop命令执行时的鼠标移动的像素步长,默认为10。 设置此值为0,意味着将为起始位置与结束位置间的每一个像素发送一个'mousemove'事件,这样做的话运行会非常的慢,甚至可能造成一些浏览器强制JavaScript超时。 如果鼠标移动步长要比两个拖动点的距离还大,selenium就只会在起始位置与结束为止发送'mousemove'事件。
Returns the number of pixels between "mousemove" events during dragAndDrop commands (default=10).
返回dragAndDrop命令执行时的鼠标移动的像素步长,默认为10.
Drags an element a certain distance and then drops it 'locator' is an element locator 'movementsString' is offset in pixels from the current location to which the element should be moved, e.g., "+70,-300"
拖动一个元素一定的距离。 'movementsString'是像素的偏移值,相对与起始位置。e.g. "+70,-300"
Drags an element and drops it on another element 'locatorOfObjectToBeDragged' is an element to be dragged 'locatorOfDragDestinationObject' is an element whose location (i.e., whose center-most pixel) will be the point where locatorOfObjectToBeDragged is dropped
拖动一个元素到另一个元素。
Returns the IDs of all windows that the browser knows about.
返回浏览器所知道的所有窗口的ID。
Returns the names of all windows that the browser knows about.
返回浏览器所知道的所有窗口的名称。
Returns the titles of all windows that the browser knows about.
返回浏览器所知道的所有窗口的标题。
Returns the entire HTML source between the opening and closing "html" tags.
返回html开合与闭合标签之间的所有HTML源码。
Moves the text cursor to the specified position in the given input element or textarea. This method will fail if the specified element isn't an input element or textarea. 'locator' is an element locator pointing to an input element or textarea 'position' is the numerical position of the cursor in the field; position should be 0 to move the position to the beginning of the field. You can also set the cursor to -1 to move it to the end of the field.
移动输入元素或文本域中的文本光标至指定的位置。如果指定元素不是输入元素或者文本域,则方法失败。 position是指定过的光标位置。0为开头,-1为结尾。
Get the relative index of an element to its parent (starting from 0). The comment node and empty text node will be ignored. 'locator' is an element locator pointing to an element
获得一个元素相对与其父元素的相对位置(从0起始)。注释节点与空文本节点叫会被忽视。
Check if these two elements have same parent and are ordered siblings in the DOM. Two same elements will not be considered ordered. 'locator1' is an element locator pointing to the first element 'locator2' is an element locator pointing to the second element
查看两个元素是否拥有相同的父元素,且在DOM中有顺序关系。两个相同的元素不会被认为是有序的。
Retrieves the horizontal position of an element 'locator' is an element locator pointing to an element OR an element itself
获得一个元素的水平坐标。
Retrieves the vertical position of an element 'locator' is an element locator pointing to an element OR an element itself
获得一个元素的垂直坐标。
Retrieves the width of an element 'locator' is an element locator pointing to an element
获得一个元素的宽度。
Retrieves the height of an element 'locator' is an element locator pointing to an element
获得一个元素的高度。
Retrieves the text cursor position in the given input element or textarea; beware, this may not work perfectly on all browsers. Specifically, if the cursor/selection has been cleared by JavaScript, this command will tend to return the position of the last location of the cursor, even though the cursor is now gone from the page. This is filed as SEL-243. This method will fail if the specified element isn't an input element or textarea, or there is no cursor in the element. 'locator' is an element locator pointing to an input element or textarea
获得给定输入元素或文本域的文本光标的位置;提示:本功能不是在所有浏览器都能完美工作。 特殊情况:如果光标(或者选择)被JavaScript清除了,此命令将返回光标最后的位置,即使光标目前不在此页中。 文档在SEL-243中。
Returns the specified expression. This is useful because of JavaScript preprocessing. It is used to generate commands like assertExpression and waitForExpression. 'expression' is the value to return
返回指定的表达式。 由于JavaScript的预处理,所以此方法很有用。它可以用来生成类似于assertExpression & waitForExpression命令。
Returns the number of nodes that match the specified xpath, eg. "//table" would give the number of tables. 'xpath' is the xpath expression to evaluate. do NOT wrap this expression in a 'count()' function; we will do that for you.
返回符合给定xpath的节点的数量,比如"//table"会返回表格的数量。
Temporarily sets the "id" attribute of the specified element, so you can locate it in the future using its ID rather than a slow/complicated XPath. This ID will disappear once the page is reloaded. 'locator' is an element locator pointing to an element 'identifier' is a string to be used as the ID of the specified element
临时设置指定元素的'id'属性,以方便在之后的操作中通过ID指定,而不是用又慢又复杂的XPath。此ID在页面被重新载入后消失。
Specifies whether Selenium should use the native in-browser implementation of XPath (if any native version is available); if you pass "false" to this function, we will always use our pure-JavaScript xpath library. Using the pure-JS xpath library can improve the consistency of xpath element locators between different browser vendors, but the pure-JS version is much slower than the native implementations. 'allow' is boolean, true means we'll prefer to use native XPath; false means we'll only use JS Xpath
指定selenium是否可以使用本地浏览器内容值得XPath引用(如果本地版本可用);如果你向函数中传递了"false",则你需要selenium的纯JavaScript xpath库。使用纯JS xpath库可以提高不同浏览器间xpath元素定位器的一致性,但是纯JS版本要比本机实现要慢。 'allow'是布尔类型。
Specifies whether Selenium will ignore xpath attributes that have no value, i.e. are the empty string, when using the non-native xpath evaluation engine. You'd want to do this for performance reasons in IE. However, this could break certain xpaths, for example an xpath that looks for an attribute whose value is NOT the empty string. The hope is that such xpaths are relatively rare, but the user should have the option of using them. Note that this only influences xpath evaluation when using the ajaxslt engine (i.e. not "javascript-xpath"). 'ignore' is boolean, true means we'll ignore attributes without value at the expense of xpath "correctness"; false means we'll sacrifice speed for correctness.
指定当使用非本地xpath评估引擎时,selenium是否无视没有值(空字符串)的xpath属性。当你想提高IE中的性能时可以使用此方法。但是,执行此方法有可能会破坏特别的xpath,比如一个查找属性不是空字符串的xpath。 幸运的是此类xpath相对来说很少,但是用户仍然应该有选择的使用它们。 提示:这个只会影响使用ajaxslt引擎时的xpath评估。 'ignore'是布尔变量,true意味着我们会在损坏xpath正确性的情况下忽视没有值得属性;false意味着我们会为了正确性而牺牲速度。
Runs the specified JavaScript snippet repeatedly until it evaluates to "true". The snippet may have multiple lines, but only the result of the last line will be considered. Note that, by default, the snippet will be run in the runner's test window, not in the window of your application. To get the window of your application, you can use the JavaScript snippet selenium.browserbot.getCurrentWindow(), and then run your JavaScript in there 'script' is the JavaScript snippet to run 'timeout' is a timeout in milliseconds, after which this command will return with an error
重复执行指定的JavaScript片段,直到它评估为'true'。此片段可能包含多行,但只有最后一行的结果会作为参考。 提示:默认情况下,这个片段会在执行者的测试窗口中执行,而不是在你的应用窗口中。为了获得你的应用的窗口,你可以使用JavaScript片段 selenium.browserbot.getCurrentWindow(),然后再你的JavaScript中执行。 timeout的单位是微秒。
Specifies the amount of time that Selenium will wait for actions to complete. Actions that require waiting include "open" and the "waitFor*" actions. The default timeout is 30 seconds. 'timeout' is a timeout in milliseconds, after which the action will return with an error
设置selenium行为的超时时间。默认为30秒。
Waits for a new page to load. You can use this command instead of the "AndWait" suffixes, "clickAndWait", "selectAndWait", "typeAndWait" etc. (which are only available in the JS API). Selenium constantly keeps track of new pages loading, and sets a "newPageLoaded" flag when it first notices a page load. Running any other Selenium command after turns the flag to false. Hence, if you want to wait for a page to load, you must wait immediately after a Selenium command that caused a page-load. 'timeout' is a timeout in milliseconds, after which this command will return with an error
等待一个新的页面载入。 你可以使用这个命令来替代'AndWait'作为后缀的命令(这些命令只可以在JS API中使用)。 selenium总是会跟踪新页面的加载,并且当他第一次注意到一个页面的加载时,设置newPageLoaded标志位。当词标志位被置为false后再执行其他的selenium命令。因此,如果你想要等待一个页面的加载,你必须在一个导致新页面加载的selenium命令运行后立即等待。
Waits for a new frame to load. Selenium constantly keeps track of new pages and frames loading, and sets a "newPageLoaded" flag when it first notices a page load. See waitForPageToLoad for more information. 'frameAddress' is FrameAddress from the server side 'timeout' is a timeout in milliseconds, after which this command will return with an error
等待一个新的frame加载。
Returns the value of the cookie with the specified name, or throws an error if the cookie is not present. 'name' is the name of the cookie
返回指定name的cookie值,如果cookie不存在则抛出错误。
Returns true if a cookie with the specified name is present, or false otherwise. 'name' is the name of the cookie
判断指定name的cookie是否存在。
Create a new cookie whose path and domain are same with those of current page under test, unless you specified a path for this cookie explicitly. 'nameValuePair' is name and value of the cookie in a format "name=value" 'optionsString' is options for the cookie. Currently supported options include 'path', 'max_age' and 'domain'. the optionsString's format is "path=/path/, max_age=60, domain=.foo.com". The order of options are irrelevant, the unit of the value of 'max_age' is second. Note that specifying a domain that isn't a subset of the current domain will usually fail.
创建一个与当前被测页面cookie具有相同路径与域名的cookie,除非你显示的指定此cookie的路径。 nameValuePair是以name=value格式的cookie的name与value。OptionsString当前支持'path', 'max_age' 和 'domain'。optionString的格式是"path=/path/, max_age=60, domain=.foo.com".选项的顺序无关紧要,'max_age'的单位是秒。 如果指定的domain不是当前domain的子集就会返回错误。
Delete a named cookie with specified path and domain. Be careful; to delete a cookie, you need to delete it using the exact same path and domain that were used to create the cookie. If the path is wrong, or the domain is wrong, the cookie simply won't be deleted. Also note that specifying a domain that isn't a subset of the current domain will usually fail. Since there's no way to discover at runtime the original path and domain of a given cookie, we've added an option called 'recurse' to try all sub-domains of the current domain with all paths that are a subset of the current path. Beware; this option can be slow. In big-O notation, it operates in O(n*m) time, where n is the number of dots in the domain name and m is the number of slashes in the path. 'name' is the name of the cookie to be deleted 'optionsString' is options for the cookie. Currently supported options include 'path', 'domain' and 'recurse.' The optionsString's format is "path=/path/, domain=.foo.com, recurse=true". The order of options are irrelevant. Note that specifying a domain that isn't a subset of the current domain will usually fail.
删除一个给定路径、域名与名称的cookie。注意:要删除一个cookie,你需要使用与创建此cookie时完全相同的路径与域名来删除它。如果路径或域名错误,cookie就无法被删除。指定的域名如果不是当前域名的子域名也会报错。 由于无法在运行的时候获取指定cookie的原始路径与域名,所以我们提供了recurse选项来尝试所有子域名与所有当前路径的子集。但这个选项会导致程序变慢。在big-O符号中,它的算法复杂度为O(n*m),其中n是域名中点的数量,m是路径中斜杠的数量。 optionsString当前支持的选项有'path','domain'和'recurse'。格式:"path=/path/, domain=.foo.com, curse=true".
Calls deleteCookie with recurse=true on all cookies visible to the current page. As noted on the documentation for deleteCookie, recurse=true can be much slower than simply deleting the cookies using a known domain/path.
递归地调用deleteCookie删除当前页面的所有课件的cookie,会很慢。
Sets the threshold for browser-side logging messages; log messages beneath this threshold will be discarded. Valid logLevel strings are: "debug", "info", "warn", "error" or "off". To see the browser logs, you need to either show the log window in GUI mode, or enable browser-side logging in Selenium RC. 'logLevel' is one of the following: "debug", "info", "warn", "error" or "off"
设置浏览器端得日志信息阈值;在此阈值下的日志信息将被丢弃。可用的logLevel有: "debug", "info", "warn", "error" or "off".想要查看日志,可以在GUI模式下的显示日志窗口,或者使能seleniumRC的浏览器端日志。
Creates a new "script" tag in the body of the current test window, and adds the specified text into the body of the command. Scripts run in this way can often be debugged more easily than scripts executed using Selenium's "getEval" command. Beware that JS exceptions thrown in these script tags aren't managed by Selenium, so you should probably wrap your script in try/catch blocks if there is any chance that the script will throw an exception. 'script' is the JavaScript snippet to run
在当前测试窗口的body中新建script标签,并且在命令body中添加特定的文本。如此debug脚本要比在selenium中执行getEval更容易。JS的异常selenium是不会管理的,所以你需要在可能出现异常的脚本中自行添加try/catch块。
Defines a new function for Selenium to locate elements on the page. For example, if you define the strategy "foo", and someone runs click("foo=blah"), we'll run your function, passing you the string "blah", and click on the element that your function returns, or throw an "Element not found" error if your function returns null. We'll pass three arguments to your function: • locator: the string the user passed in • inWindow: the currently selected window • inDocument: the currently selected document The function must return null if the element can't be found. 'strategyName' is the name of the strategy to define; this should use only letters [a-zA-Z] with no spaces or other punctuation. 'functionDefinition' is a string defining the body of a function in JavaScript. For example: returninDocument.getElementById(locator);
定义一个新函数,用来selenium定位页面中的元素。比如,如果你定义一个策略"foo",并且有人执行click("foo=blah"),我们就会执行你的函数,传递给你字符创"blah",并点击你函数返回的元素,如果函数返回为null则抛出异常。 我们将会传递3个参数给你的函数: ○ locator:用户传入的字符串 ○ inWindow:当前选择的窗口 ○ inDocument:当前选择的文件 当元素找不到时,函数必须返回null。 'strategyName'是要定义的策略的名称;要使用大小写字母,并且没有空格与标点。'functionDefinition'是JavaScript中函数定义体字符串。比如returninDocument.getElementById(locator);
Saves the entire contents of the current window canvas to a PNG file. Contrast this with the captureScreenshot command, which captures the contents of the OS viewport (i.e. whatever is currently being displayed on the monitor), and is implemented in the RC only. Currently this only works in Firefox when running in chrome mode, and in IE non-HTA using the EXPERIMENTAL "Snapsie" utility. The Firefox implementation is mostly borrowed from the Screengrab! Firefox extension. Please seehttp://www.screengrab.org and http://snapsie.sourceforge.net/ for details. 'filename' is the path to the file to persist the screenshot as. No filename extension will be appended by default. Directories will not be created if they do not exist, and an exception will be thrown, possibly by native code. 'kwargs' is a kwargs string that modifies the way the screenshot is captured. Example: "background=#CCFFDD" . Currently valid options: * background the background CSS for the HTML document. This may be useful to set for capturing screenshots of less-than-ideal layouts, for example where absolute positioning causes the calculation of the canvas dimension to fail and a black background is exposed (possibly obscuring black text).
保存当前窗口的所有内容到一个PNG文件中。 对比captureScreenshot命令,它截取当前显示器中显示的所有内容,并且只由RC引入。目前此方法只在运行chrome模式的Firefox中支持。
Executes a command rollup, which is a series of commands with a unique name, and optionally arguments that control the generation of the set of commands. If any one of the rolled-up commands fails, the rollup is considered to have failed. Rollups may also contain nested rollups. 'rollupName' is the name of the rollup command 'kwargs' is keyword arguments string that influences how the rollup expands into commands
执行具有一个名字的一系列命令的rolllup,可选参数用来控制命令集的生成。如果rolled-up命令的任何一个失败,则rollup被认为失败。rollups中可能包含嵌入的rollup。 rollupName是rollup命令的名称。kwargs是影响rollup如何在命令中展开的关键参数字符串
Loads script content into a new script tag in the Selenium document. This differs from the runScript command in that runScript adds the script tag to the document of the AUT, not the Selenium document. The following entities in the script content are replaced by the characters they represent: < > & The corresponding remove command is removeScript. 'scriptContent' is the Javascript content of the script to add 'scriptTagId' is (optional) the id of the new script tag. If specified, and an element with this id already exists, this operation will fail.
在selenium文档中加载脚本内容到一个新的脚本标签中。此命令与runScript不同之处在于,runScript在AUT的文档中添加script标签,不是selenium文档。 下面的实体会被其所代表的内容而替代: < > & 相对应的删除指令是removeScript。 scriptTagId(可选)是新脚本标签的ID,如果指定的ID已经存在,那操作会失败。
Removes a script tag from the Selenium document identified by the given id. Does nothing if the referenced tag doesn't exist. 'scriptTagId' is the id of the script element to remove.
从selenium中删除给定tag id的脚本。如果指定的tag不存在则什么都不做。
Allows choice of one of the available libraries. 'libraryName' is name of the desired library Only the following three can be chosen: * "ajaxslt" Google's library * "javascript-xpath" Cybozu Labs' faster library * "default" The default library. Currently the default library is "ajaxslt" . If libraryName isn't one of these three, then no change will be made.
指定可用库。 目前支持的库名有: * "ajaxslt" Google's library * "javascript-xpath" Cybozu Labs' faster library * "default" 当前默认的库为ajaxslt。
Writes a message to the status bar and adds a note to the browser-side log. 'context' is the message to be sent to the browser
在状态栏中写入一条信息,在浏览器log中加入一条记录。
Sets a file input (upload) field to the file listed in fileLocator 'fieldLocator' is an element locator 'fileLocator' is a URL pointing to the specified file. Before the file can be set in the input field (fieldLocator), Selenium RC may need to transfer the file to the local machine before attaching the file in a web page form. This is common in selenium grid configurations where the RC server driving the browser is not the same machine that started the test. Supported Browsers: Firefox ("*chrome") only.
为一个上传框赋值为fileLocator中的文件。 fileLocator是指向特定文件的URL。在文件被设置到fieldLocator前,seleniumRC会将文件传送到本机。对于RC server与启动测试浏览器不在同一个机子的selenium grid,这是一个常见配置。 目前只支持Firefox。
Captures a PNG screenshot to the specified file. 'filename' is the absolute path to the file to be written, e.g. "c:lahscreenshot.png"
截取一张PNG屏幕截图,保存到指定名称。
Capture a PNG screenshot. It then returns the file as a base 64 encoded string.
截图PNG屏幕截图。返回base64编码的字符串。
Returns the network traffic seen by the browser, including headers, AJAX requests, status codes, and timings. When this function is called, the traffic log is cleared, so the returned content is only the traffic seen since the last call. 'type' is The type of data to return the network traffic as. Valid values are: json, xml, or plain.
返回浏览器可见的网络信息,包括header, ajax 请求,状态码和计时。调用此方法时,日志会被清除,所以返回的内容只是上次调用的内容。 type支持的类型有:json, xml 和 plain。
Tells the Selenium server to add the specificed key and value as a custom outgoing request header. This only works if the browser is configured to use the built in Selenium proxy. 'key' the header name. 'value' the header value.
使selenium服务器为out的请求header添加指定的K—V。 只在被设置使用selenium代理的浏览器中生效。
Downloads a screenshot of the browser current window canvas to a based 64 encoded PNG file. The entire windows canvas is captured, including parts rendered outside of the current view port. Currently this only works in Mozilla and when running in chrome mode. 'kwargs' is A kwargs string that modifies the way the screenshot is captured. Example: "background=#CCFFDD". This may be useful to set for capturing screenshots of less-than-ideal layouts, for example where absolute positioning causes the calculation of the canvas dimension to fail and a black background is exposed (possibly obscuring black text).
下载一个当前窗口画面的截图,based64编码的PNG图片。 整个窗口画面被截取,包括不在当前显示器中的部分。 目前只工作在chrome模式下的Mozilla。
Kills the running Selenium Server and all browser sessions. After you run this command, you will no longer be able to send commands to the server; you can't remotely start the server once it has been stopped. Normally you should prefer to run the "stop" command, which terminates the current browser session, rather than shutting down the entire server.
关闭运行中的selenium服务器以及所有的浏览器会话。执行此命令后,你不可以再向服务器发送指令;你不能再远程启动服务器。通常情况下,你只需要执行stop指令就可以了,它会种植当前浏览器的会话,而不是关闭整个服务器。
Retrieve the last messages logged on a specific remote control. Useful for error reports, especially when running multiple remote controls in a distributed environment. The maximum number of log messages that can be retrieve is configured on remote control startup.
获得指定RC中的最后一个日志信息。对于错误报告很有用,特别是在分布式环境中运行多个RC。可获取的日志信息的最大数量在RC启动时设置。
Simulates a user pressing a key (without releasing it yet) by sending a native operating system keystroke. This function uses the java.awt.Robot class to send a keystroke; this more accurately simulates typing a key on the keyboard. It does not honor settings from the shiftKeyDown, controlKeyDown, altKeyDown and metaKeyDown commands, and does not target any particular HTML element. To send a keystroke to a particular element, focus on the element first before running this command. 'keycode' is an integer keycode number corresponding to a java.awt.event.KeyEvent; note that Java keycodes are NOT the same thing as JavaScript keycodes!
模拟用户按下一个键,发送本机操作系统的keystroke。本函数调用java.awt.Robot类来发送keystroke;这个更准确的模拟在键盘上输入一个键。本命令不指定任何html元素。如果要想特定的元素发送键击,首先移动焦点到该元素,然后执行命令。 此处的keycode是指java.awt.event.KeyEvent中的键码;注意java键码与javascript的键码是不同的。
Simulates a user releasing a key by sending a native operating system keystroke. This function uses the java.awt.Robot class to send a keystroke; this more accurately simulates typing a key on the keyboard. It does not honor settings from the shiftKeyDown, controlKeyDown, altKeyDown and metaKeyDown commands, and does not target any particular HTML element. To send a keystroke to a particular element, focus on the element first before running this command. 'keycode' is an integer keycode number corresponding to a java.awt.event.KeyEvent; note that Java keycodes are NOT the same thing as JavaScript keycodes!
模拟用户释放一个按压的键,发送本地操作系统的键击。
Simulates a user pressing and releasing a key by sending a native operating system keystroke. This function uses the java.awt.Robot class to send a keystroke; this more accurately simulates typing a key on the keyboard. It does not honor settings from the shiftKeyDown, controlKeyDown, altKeyDown and metaKeyDown commands, and does not target any particular HTML element. To send a keystroke to a particular element, focus on the element first before running this command. 'keycode' is an integer keycode number corresponding to a java.awt.event.KeyEvent; note that Java keycodes are NOT the same thing as JavaScript keycodes!
模拟用户按下并释放键,发送本地操作系统的键击。