Winium.Desktop icon indicating copy to clipboard operation
Winium.Desktop copied to clipboard

Right click and moving the cursor

Open danishrizwan91 opened this issue 4 years ago • 1 comments

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();
	
	
	
	
}

}

danishrizwan91 avatar Aug 01 '19 12:08 danishrizwan91

You can integrate additional utilities like robot class/autohotkey tools to do copy and paste

https://www.autohotkey.com/

nananand7 avatar Jan 30 '20 08:01 nananand7