How to Open Browser using Sikili script

Asked by satisha

I want to integrate Sikuli with Selenium Web driver,
Brief summary what I did
1)Downloaded “sikuli-api-1.0.2-standalone” and added to the project
2)Able to launch browsers by Selenium and used the Sikuli script where ever its needed.
My Questions
1)How to Launch[Invoke] the browser using Sikuli scripts
In Sikuli API we use APP.open[path], similar way how to use in the Sikuli script in Eclipse.
I tried with new URL("http://code.google.com");
Its not working.
Could to tell how to invoke the browsers when we used ““sikuli-api-1.0.2-standalone” jars
2)Could you tell me how to invoke the Safari browser using the Sikuli script
I tried with below code its not working
*File file = new File("C://Users//E744443//Desktop//Sikuli//extension.safariextz");
  SafariOptions options = new SafariOptions();
  options.addExtensions(file);
  // Option 1: Locally.
  WebDriver driver = new SafariDriver(options);
  driver.get("https://www.google.com");

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Eugene S
Solved:
Last query:
Last reply:
Revision history for this message
Eugene S (shragovich) said :
#1

Hi,

When using Java, you can use the same App class with "open" method. You can see a detailed description here:
http://doc.sikuli.org/javadoc/org/sikuli/script/App.html

However I'm not sure it will work for you to start the browser with Sikuli and then driving it with Selenium. When using Selenium, you have to assign the browser to a driver handle, for example:

WebDriver driver = new FirefoxDriver();
driver.get("http://www.google.com");

So if you launch the browser with Sikuli, you won't be able to use Selenium methods because there will be no driver object.

Revision history for this message
satisha (satishc-gowda) said :
#2

Yes yor are correct
I have one more clarification
As we now by definition of Sikuli means we can Automate anything in the screen
Could you tell me by Sikuli script how to Automate some Windows based ,
Suppose I want to open ‘SQL Developer’ and connect to the Database and Execute some SQL quires and l also want to copy the text form the specified column.[ Same what we do in manual , I want to by Sikuli script. For this we cannot use selenium]
Steps I want to do from Sikuli scripts
1) open ‘SQL Developer’
2) connect to the Database
3) Execute some SQL quires
4) copy the text form the specified column

Revision history for this message
Eugene S (shragovich) said :
#3

1. You can launch an application using different approaches, for example:
  1.1 Use the App class as explained before
  1.2 Use Windows Run:
    type("r", KEY_WIN)
    type(<app location>)
    type(Key.ENTER)

2. To connect to the database and to execute the queries, you will have to click on relevant button in SQL Developer and use "type" to input text.

3. Copying text directly could be a problem since text recognition is still not 100% reliable. So what you can do is:
  3.1 Somehow copy it to clipboard and the use it
  3.2 Export it to a file and read it from there

Revision history for this message
satisha (satishc-gowda) said :
#4

thanks for response
As i am new to sikuli Could you explain how to click on the SQL Developer
If we want to consider X and Y Co ordinates to click how to take those and click

If you can send the code in java that would be great

Revision history for this message
Best Eugene S (shragovich) said :
#5

In my previous comment I have mentioned how can you open an application. Did you try that? Did you get any results/errors?

Revision history for this message
satisha (satishc-gowda) said :
#6

Thanks Eugene S, that solved my question.