I want to know how to open URL in existing browser window in selenium web driver - selenium

I am working on selenium web driver. I want to open existing browser window via selenium script(Java).

There is no built-in method in Selenium that supports this feature directly. However, you can try the following:
driver.get("link");
driver.find_element_by_link_text('new link name').click().switch_to.window(driver.window_handles[0]);
Just switch to handle for self.You can also try storing handles in variables if you like.
The whole post can be found here.

Related

How we can automate real browser instead of using selenium browser instance

I am trying to scrape a website, but it is not loading in selenium. When I browse that website in my "real" chrome browser, everything works fine. Is there any way I can use my real browser with python to automate stuff, instead of using selenium??
Thanks
Using selenium we can automate real browsers.
If in case the website is not loading via selenium, you can check if adding desired capabilities helps.
Here we can set proxy, disable extensions etc. There are many options available.
https://chromedriver.chromium.org/capabilities
Also if you can share what kind of error is displayed that would be helpful.

How to open and close browser in RFT

I am new to RFT and i just want simple script to open browser and close the same using RFT.
I tried to find solution on internet but there were solutions which i can't digest.
Help me out on this
First, you need to enable your browser. Then configure your application. After that you can use the recorder to start your configured application (this starts the browser if it is a web application) and you can also use the recorder to record the close browser action.
For starting your browser the generated code will be something like this:
startApp("nameOfTheAppYouConfigured");
For closing:
browser_htmlBrowser(document_YourDocument(), MAY_EXIT).close();
BTW: What is so difficult in following a guide like this or just using the RFT tutorials...

How can I access browser extension's popup using selenium?

I want to write an acceptance test for my browser extension. I've tried to initiate an extension via selenium but I can't seem to access a content of popup. Can someone suggest how can I do it with selenium or any other way to write UI/acceptance tests for browser extensions? Thanks.
How can I access browser extension's popup using selenium?
It's not possible. Selenium supports interaction with web view only.
What you can do with Selenium and extension for sure is automatic installation: https://stackoverflow.com/a/16512012/2517622
You may try to use desktop automation tools (e.g. White on Windows platform) for clicking on extension popup but it's not that easy and it's not platform independent as Selenium.
Here is the workaround we came up. Unless someone posts here the "right" solution I will consider this as the best approach.
So eventually, our extension is an iframe which just loads a page content from our website + does some other neat stuff. We simply open that url in a new tab and do regular selenium tests.
Side not: we have considered to write a little javascript wrapper to be able to access ext via main window through javascript. E.g. there is some js in ext that listens to main window's events and perform certain actions. Tho, it is too much efforts and doesn't really sound like a proper acceptance test so we discarded this approach.

Selenium Golang binding without server

There are many selenium webdriver binding package of Golang.
However, I don't want to control browser throught server.
How can I control browser with Golang and selenium without selenium server?
You can try github.com/fedesog/webdriver which says in its documentation:
This is a pure go library and doesn't require a running Selenium driver.
I would characterize the Selenium webdriver as a client rather than a server. Caveat: I have used the Selenium webdriver (Chrome version) from .Net and I am assuming it is similar for Go.
The way Selenium works is that you will launch an instance of it from within code, and it creates a live version of the selected browser (i.e. Chrome) and your program retains control over it. Then you write code to tell the browser to navigate to a page, inspect the response, and interact with the browser by filling out form data, clicking on buttons, etc. You can see what is happening on the browser as the code runs, so it is easy to troubleshoot when the interaction doesn't go as planned.
I have used Selenium to upload tens of thousands of records to a website that has no API and only a graphical user interface. Give it a chance.

Using Selenium webdriver on a custom webkit browser

I have successfully tested applications in FireFox using Selenium WebDriver, but one of our applications runs in a custom browser made using QTWebKit. Is it possible to use WebDriver to automate testing in a custom browser like this?
There is a webdriver for QtWebkit here: https://github.com/cisco-open-source/qtwebdriver
It also can automate qtwidget and QML aplications.
You should be able to use it to automate you custom browser, provided you preserved the QtWebkit APIs.
If QTWebKit has released a WebDriver executable for the browser, then yes.
Otherwise - no.