-
Notifications
You must be signed in to change notification settings - Fork 143
Command Execute Script
Saikat edited this page Sep 19, 2018
·
5 revisions
Script starting with "input:" prefix supports following commands:
-
ctrl_click- simulate pressing key combo ctrl+click. Script argument: -
element- element on element on which simulated -
brc_click- simulate pressing click to element center (by bounding rectangle). Script argument: -
element- element on element on which simulated
Examples
element = self.driver.find_element_by_id("ClickedElement")
self.driver.execute_script("input: ctrl_click", element)Script starting with "automation:" prefix supports following commands:
-
ValuePattern.SetValue- sets property on element to specified value. Script argument: -
element- element on wich attribute will be set -
value- value to be set
Examples
date_time_picker = self.driver.find_element_by_id("DateTimePicker")
self.driver.execute_script("automation: ValuePattern.SetValue", date_time_picker, "29.06.15 05:00")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();
} }