Winium.Desktop
Winium.Desktop copied to clipboard
Right click and moving the cursor
Hi Team,
I am trying to write a script to Open R Studio and then Running a script. The problem i am facing : a. I need to perform rightclick and then select all which i am unable to perform. b. is there any way to use key board CtrlA+Ctrl C to select and copy. c. Also i need to first click on the script editor area to perform right click.
Since i am relatively new to this thing would really require your help.
Code below:
package WiniumRAutomate;
import java.awt.Desktop.Action; import java.net.MalformedURLException; import java.net.URL;
import org.openqa.selenium.By; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.winium.DesktopOptions; import org.openqa.selenium.winium.WiniumDriver;
public class firstStep {
public static void main(String[] args) throws MalformedURLException, InterruptedException {
// TODO Auto-generated method stub
DesktopOptions option=new DesktopOptions();
option.setApplicationPath("C:\\Program Files\\RStudio\\bin\\rstudio.exe");
WiniumDriver driver = new WiniumDriver(new URL("http://localhost:9999"), option);
Thread.sleep(1000);
driver.findElement(By.name("RStudio - 1 running window"));
Thread.sleep(1000);
Actions action=new Actions(driver);
Object items = driver.findElement(By.className("rstudio::desktop::WebView"));
action.contextClick(items).perform();
object menu = driver.findElement(By.className("rstudio::desktop::WebView"));
menu.find_element_by_name("Select all").click();
}
}
You can integrate additional utilities like robot class/autohotkey tools to do copy and paste
https://www.autohotkey.com/