-
Notifications
You must be signed in to change notification settings - Fork 142
Supported Commands
Winium.Desktop implements subset of JSON Wire Protocol
POST /session/:sessionId/element/:id/clear Clear a text the element.
element.clear()
POST /session/:sessionId/element/:id/click Click on an element.
element.click()
DELETE /session/:sessionId/window Close the associated application.
driver.close()
GET /session/:sessionId/element/:id/equals/:other Test if two element IDs refer to the same visual-tree element.
For details see Command Execute Script
POST /session/:sessionId/execute Execute custom command.
driver.execute_script('input: ctrl_click')
POST /session/:sessionId/element/:id/element Search for an element on the page, starting from the identified element.
See Finding Elements for supported strategies.
parent = find_element_by_name(name1)
parent.find_element_by_id(id_)
# see FindElement above
POST /session/:sessionId/element/:id/elements Search for multiple elements on the page, starting from the identified element.
parent = find_element_by_name(name1)
parent.find_elements_by_name(name2)
# see FindElements above
POST /session/:sessionId/element Search for an element on the page, starting from the desktop root.
See Finding Elements for supported strategies.
# find by AutomationProperties.AutomationId
driver.find_element_by_id(id_)
# find by Name
driver.find_element_by_name(name)
POST /session/:sessionId/elements Search for multiple elements on the page, starting from the desktop root.
See Finding Elements for supported strategies.
driver.find_elements_by_class_name('System.Windows.Controls.TextBlock')
driver.find_elements_by_tag_name('System.Windows.Controls.TextBlock')
# find by AutomationProperties.AutomationId
driver.find_elements_by_id(id_)
# find by Name
driver.find_elements_by_name(name)
POST /session/:sessionId/element/active Get the element on the page that currently has focus.
driver.switch_to.active_element()
GET /session/:sessionId/element/:id/attribute/:name Get the value of an element's attribute. Supported attributes it is automation properties from AutomationElementIdentifiers class.
# get by full property name
element.get_attribute('IsEnabledProperty')
# get by short property name
element.get_attribute('IsEnabled')
GET /session/:sessionId/element/:id/size Determine an element's size in pixels.
element.size()
GET /session/:sessionId/element/:id/text Returns the visible text for the element.
element.text
POST /session/:sessionId/timeouts/implicit_wait Set the amount of time the driver should wait when searching for elements.
driver.implicitly_wait(10)
GET /session/:sessionId/element/:id/displayed Determine if an element is currently displayed by IsOffscreen property.
element.is_displayed()
GET /session/:sessionId/element/:id/enabled Determine if an element is currently enabled.
element.is_enabled()
GET /session/:sessionId/element/:id/selected Get SelectionItemPattern.IsSelectedProperty value.
element.is_selected()
POST /session/:sessionId/click Click any mouse button (at the coordinates set by the last moveto command).
# see more http://selenium-python.readthedocs.org/en/latest/api.html#module-selenium.webdriver.common.action_chains
actions = ActionChains(driver)
# ...
actions.click()
actions.perform()
POST /session/:sessionId/doubleclick Double-clicks at the current mouse coordinates (set by moveto).
# see more http://selenium-python.readthedocs.org/en/latest/api.html#module-selenium.webdriver.common.action_chains
actions = ActionChains(driver)
# ...
actions.double_click()
actions.perform()
POST /session/:sessionId/moveto Move the mouse by an offset of the specificed element.
# see more http://selenium-python.readthedocs.org/en/latest/api.html#module-selenium.webdriver.common.action_chains
actions = ActionChains(driver)
# ...
actions.move_by_offset(xoffset, yoffset)
actions.perform()
POST /session Create a new session.
DELETE /session/:sessionId Delete the session.
driver.quit()
GET /session/:sessionId/screenshot Take a screenshot of the current page.
driver.get_screenshot_as_base64()
driver.get_screenshot_as_file(filename)
driver.get_screenshot_as_png()
POST /session/:sessionId/keys Send a sequence of key strokes to active element.
action = ActionChains(driver)
action.send_keys(text)
POST /session/:sessionId/element/:id/value Send a sequence of key strokes to an element.
element.send_keys(text)
GET /status Query the server's current status.
POST /session/:sessionId/element/:id/submit Simulate pressing Enter key.
element.submit()
package testcases; import java.net.MalformedURLException; import java.net.URL; import org.openqa.selenium.By; import org.openqa.selenium.winium.DesktopOptions; import org.openqa.selenium.winium.WiniumDriver public class calculator {
public static void main(String[] args) throws MalformedURLException, InterruptedException { DesktopOptions option = new DesktopOptions(); option.setApplicationPath("C:\\Windows\\System32\\calc.exe"); WiniumDriver driver = new WiniumDriver(new URL("http://localhost:9999"), option); Thread.sleep(5); driver.findElement(By.name("Five")).click(); driver.findElement(By.id("multiplyButton")).click(); driver.findElement(By.name("Six")).click(); driver.findElement(By.id("equalButton")).click();
} }