Create a VFP Chrome or FireFox Object - sql-server

We have a VFP application and need to open a specific site in Chrome or Firefox. The site is optimized for either of those browsers.
We know how to Createobject for InternetExplorer.Application to open a browser inside our application. This allows us to interract with the browser. However, it works only with IE.
Does anyone know how to accomplish the same purpose using either Chrome or Firefox?
We have done this to open the default browser (which is Chrome or Firefox).
oShell = Createobject("wscript.shell")
oShell.Run(lcUrl)
The issue with this approach is that it just opens the browser and we cannot interact with it (e.g. pass values and read items on the page).
At a minimum, if we can open Chrome or Firefox and pass POST parameters without using a querystring that would be an acceptable start.

Chrome doesn't expose an OLE Automation interface so I think you are out of luck with CreateObject(). You might be able to send keystrokes to it somehow but it would be kludgey at best.

Related

Working interactively with WebExtensions in Firefox

I have a page which leads to other pages that loads mp3 files. I want to download them. All pages and links are build dynamically.
In a past I used Scratchpad but now it is deprecated and new API is here WebExtensions
I can't call browser.tabs.create from console. How can I interactively use WebExtensions in Firefox?
The code that used to be run from the Scratchpad can still be run from the Browser Console. The Browser Console can be open from the Web Developer menu or using Ctrl+Shift+J.

Angularjs application fails to load UI properly on a chrome 76 launched by chromedriver 75 and above

Open Angularjs application on chrome with chromedriver through selenium. Try to click on the buttons it moves constantly up and down, which makes it impossible to click and selenium fails to click as the application is bouncing on the screen.
However, tried to replicate the same with a chrome browser manually launched it never happens.
Open the browser through chrome driver and launch the angularjs application manually UI keeps bouncing.
This means the issue happens only with a browser launched by chrome driver.
Tried with older chromedriver and chrome, this doesn't happen. Happens only with later releases of chromedriver i.e. 76 and above.
Angularjs version 1.7.2
Local chrome does work properly.
I used basic way of initiating the chrome with the below code, still no luck
var driver = new ChromeDriver();
Since the chrome browser behave differently only when launched through chromedriver, also since launching local chrome doesn't have an issue. I tried to launch the chrome as it would launch manually.
var options = new ChromeOptions() { AcceptInsecureCertificates = true };
options.AddArguments($"user-data-dir=/Users/{Environment.UserName}/AppData/Local/Google/Chrome/User Data");
var driver = new ChromeDriver(options);
The approach of using local profile user data does help to a certain extent when running on local machines, but when running on a remote machine it fails again and also you can't launch two browsers as the user data folder is used by one browser at a time, not feasible to have only one chrome browser and not multi threadable.
The latest chromedriver version 76 is w3c complaint so its better to use later versions than using older chromedriver.
Any suggestions or insights on why this happens only with chrome launched by chromedriver. will be well appreciated and also happens only with angular application.

How do I make selenium see the network requests made by a web browser?

I have a dotnet Selenium web driver app.
When I'm testing the page one of the things I need to confirm is that a flash object on the page has pulled correct content from a content store on my site. (i.e. the flash object should be loading content from /stuff/info.txt and including that content within the animation.)
As a human looking at this I can use the chrome network tab and see that /stuff/info.txt has been accessed.
How can I make Selenium execute a similar watch and see the network requests made by a web browser?
I did not wrote this, neither tested it however someone did it here: http://www.softwareishard.com/blog/firebug/automate-page-load-performance-testing-with-firebug-and-selenium/
Basically all the requests are exported via netexport and firebug plugins inside a HAR (Http ARchive file)
Please give us your feedback if you give it a try!
Cheers !
I assume you want to automate the process which the developer tools of browsers does. Something like firebug but for verification using Code.
I don't believe Selenium has such features. For now, you will not be able to achieve this.

Browser Automation with Selenium: Fingerprints, recognizability and traceability?

I want to use selenium/webdriver to simulate a browser and scrape some website-content with it. Even if its not the fastest method, for me it has many advantages such as executing scripts etc.
For many websites it is forbidden to access them via an automated method, for example search engines like google or bing.
For one tool i need to scrape the estimated resultstat from google for several keywords. This will look like the following: simulate the browser that visits google.com and types in a keyword and scrapes the results, then after a little pause type in the next keyword, scrape the results and so on...
My question is: Is it possible for a website to recognize that I'm using selenium to simulate the browser instead of using the browser by hand? Especially the google case gives me some doubts. I know selenium is partly developed by google or at least by some guys working for google. So does leave selenium some fingerprints or isn't it possible to decide if I'm using the browser by myself or simulated by selenium, even for google?
No, nobody can actually see that you're using Selenium and not hand-operating the browser yourself with WebDriver. I'm not sure about the old Selenium RC, but it should be the same way. Here's how it works:
Selenium opens up a browser with a clean profile (or with a profile you selected)
Selenium is hooked up to the browser so it can steer it, control it. But the browser still does most of the work. Basically, Selenium replaces the user inputs to the browser, but not more.
You can easily verify this by reading the contents of the HTTP headers sent by your browser.
If you ever actually needed Selenium to be recognized by your server, you can use Browsermob-proxy and add a custom header to your requests.
All that said, there is one thing you must be aware of. While there's no way to detect Selenium directly, there can be some indirect clues picked up by the website you're visiting. Those usually include scanning for too many requests made in virtually no time - this might be an issue for you. Make sure your Selenium is behaving like a user.
EDIT 2016/04:
Apparanetly it is possible as https://stackoverflow.com/a/33403473/2930045 states that a company can do it. My guess - and it is nothing but a guess - is that they can run some JS that Selenium installs into the browser to operate.
Signs point to yes, sites are able to regonize that you are using Selenium.
Counter Example: www.stubhub.com detects and blocks my browser instance launched using Selenium while "normal" browsing done manually (not using the browser launched by the Selenium web driver) work with out issue.
See this stackoverflow question for additional details
Can a website detect when you are using selenium with chromedriver?

Issue in clicking on the browse button with selenium in IE

I am Clicking on the browse button in IE using Selenium Webdriver code in an upload file utility by reading the co-ordinates of the browse text. Whlie the code works fine in some machines in IE and firefox both, in yet another machine the same code is working for firefoxx but the browse button becomes unclickable in IE. We checked the settings in internet options, everything looks alike in both machines.
Please let us know if anyone faced any such issue and the resolution that could work.
If there is any other way to upload the file in your app by avoiding the "Browser" button method, then that is always preferred. Some people will use Apache HTTPComponents to do a POST upload to the servlet that the "Browse" button refers to. That is by far the preferred method rather than using WebDriver. The problem with the Browse button is that it opens native OS controls ( in some cases) and the only way you can control those is by using the Sikuli API to click on elements based on finding them with matching screenshots. Also, if you use Sikuli, you can't run multiple browser tests on the same machine since each test will block screen comparisons of another test and that will rule you out of using RemoteWebDriver.

Resources