How to change Opera's proxy settings from Watir-Webdriver? - ruby

(This question is loosely related to my previous question)
Hello there.
I have been using Watir-Webdriver with Mozilla FireFox for a week now, and I am quite pleased with it. However, since I am making a test wich tries to connect to some websites multiple times using different proxies, I found that using FireFox was extremely slow. Firefox's starting time is (at least on my computer) about 15 seconds(if you're lucky) so I am looking to find something to speed the thing up. This made me look into other browsers and their start up times. It seems Opera is quite fast. However, since it is 'new' in Selenium Webdriver and thus also in Watir-webdriver there is not much documentation about it.
Enough talking, time for the question:
How can I, using watir-webdriver(or Selenium-webdriver directly), change the proxy that Opera uses for connections?

I'm not quite sure I understand the use case, but as a hack/workaround you can change any Opera setting from OperaWatir by loading opera:config and running JS in it to set preferences. In other words,
browser.goto('opera:config')
browser.execute_script( 'opera.setPreference("Proxy", "HTTP Server", "127.0.0.1:8888")' )
browser.execute_script( 'opera.setPreference("Proxy", "Use HTTP", "1")' )
should work without restart or anything. The opera:config page itself shows you the options you can set.

Related

How, as a programmer, to report bugs I find in core Gecko browser-engine behavior in Firefox

When I’m programming a Web app and I run into a problem that only seems to happen in one browser, I know that a somewhat-essential step among my overall programming tasks as a “good citizen” is to stop coding for a bit and take time to report the bug in the right place—so it can get fixed and other Web developers (including me) hopefully won’t run into the same problem later.
In such cases with Firefox, I understand enough to know when the cause of the programming problem I’m seeing is in the core “Gecko” browser-engine code in Firefox (rather than instead being, say, a bug in the Firefox user-interface code—the code for the so-called browser “chrome”).
Given that, is there a URL that will take me directly the form where I can quickly get to the right bugzilla “product” and “component” to report a Gecko browser-engine bug against?
Having already reported a few bugs in the Gecko code, I am somewhat annoyed at being forced to use the form at https://bugzilla.mozilla.org/enter_bug.cgi, which seems to assume I’m reporting a bug for the first time and I want guided step-by-step help. But this ain’t my first barbecue…
https://bugzilla.mozilla.org/enter_bug.cgi?product=Core&format=default is the URL you want.
That’s because in the case of Firefox, the right bugzilla “product” to use for browser-engine (Gecko) bugs is actually Core (not the Firefox component—and there is no Gecko component).
That URL above takes you directly to an actual bug-reporting page—that is, as you’d want, it completely skips all the designed-for-first-time-bug-reporters step-by-step guided-help stuff.
You do need to then manually choose the right “component” from the Component list there, but if you already know the right component, you can make a bookmark that includes it; e.g., https://bugzilla.mozilla.org/enter_bug.cgi?product=Core&component=DOM%3A%20Workers&format=default is a URL that will let you report problems with Firefox Web-Workers behavior.
Adding the &format=__default__ parameter/value is the important part needed to get bugzilla to skip all the designed-for-first-time-bug-reporters step-by-step guided-help stuff.

How to find out difference behavior between chrome driver and phantomjs

When I want to have automated browser function with selenium-webdriver, I write at first with chrome driver and then make it run with phantomjs.
But sometimes the two browsers behave differently and the function fails to run with phantomjs while selenium-webdriver works fine.
Currently, to find out what is wrong I am struggling in command line. I wonder if there is a way to run phantomjs with "head" so that I can see the problem at a glance. Or maybe is there way to make chrome behave exactly like phantomjs?
I'm aware of some web site are restricted to get information by headless server, I'd give up in that case.
I faced with the same situation a time ago. In that case I used this gem to take a screenshot on each capybara failure. It doesn't answer to you what has exactly happened, but at least you can find out if page has required elements and so on.

Website running slow in IE with no specific reason why

We have a website that a few people are complaining about it running extremely slow. We're struggling to figure out why and to even recreate it. Most are mentioning that it's running slow in IE.
It's not limited to any specific section of the site, just the whole thing in general.
There's been several developers creating/adjusting the code so it's overly bloated but we can't see any specific reason why this should happen.
Can anyone see why?
We've also run a speed test:
I was running a profiling test with IE on your website and there is a call to:
http://www.playforce.co.uk/-ms-transform.htc
Which is giving error 404 not found and taking 1 second to complete (0.91 sec).
If is found all around your css under this line:
behavior:url(-ms-transform.htc);
Am no expert !! Am welcome to better suggestion and corrections of what i am about to say
You can try using a trial version of Borland Silk meter ..
They tend to measure the speed with which each element loads using various browsers and various geographical locations which are configurable by you.
Also , since only some of the user's are complaining about the speed being an issue you should also check the speed of their internet and their browser version and other addon etc of those users. Because sometimes the problem is not only with the server .
Try the above tool to confirm nothing is wrong in your server and then proceed to checking the client's browser and network.

IE takes too much time to load the page compared to Firefox

I have a page which displays around 1000 records.
The page gets loaded quite easily on firefox..around 2 seconds. But same on IE taking more that 10 seconds.
I checked performance tuning on server side, and modified the hibernate Criteria query returning this whole data. But issue is still there.
I also tried to remove almost all the plugins from IE thinking those could be the culprits. But no impact. :(
Trying to monitor the UI components on IE developer tool, but didnt find much details.
Any suggestions please. :)
Thanks in Advance :)
Performance issues like this will be down to rendering the UI. The server side processing won't vary from browser to browser, so it will be down to the way different browsers handle the drawing of the elements. Without seeing your page in action it is not easy to suggest anything to help improve your situation.
Guys Got the Culprit here... :) :)
After doing lot of RnD on Server side and Client side, I took a look at "Developer Tool" in IE.
You can find something like "Document Mode: Quirks". If you check the Wiki page for this Quirks mode, You can find a definition as "In computing, quirks mode refers to a technique used by some web browsers for the sake of maintaining backward compatibility with web pages designed for older browsers, instead of strictly complying with W3C and IETF standards in standards mode."
So this all becuase of checking for compatibility for all components on page. And hence the performance issue. :)
And When I changed this mode to IE 8 Standard. Things started working really well.
IE and its issues ...!!!! :D

Selenium hanging and timing out on basic page interactions on OWA.

I'm using Selenium with a local FireFox browser to access live.com's spam box and read the email. For testing purposes, I've been using "binding.pry" to interact with my script and see where the problems are.
When I try to find the element representing an inbox message:
driver.find_element(:css,"#messageListContentContainer .ia_hc")
I get this error after 60 seconds:
Timeout::Error: execution expired
from /usr/lib/ruby/1.8/timeout.rb:64:in `rbuf_fill'
But, as I'm in Pry, I can quickly repeat the same command. After about 5 or 10 seconds, it finds the element.
Obviously I can get around the problem by putting a before, rescue, retry block around the call, but that means I'll have to wait 70-80 seconds to click a single email. Does anyone have any idea why find_element is taking so long that it times out, or why it doesn't time out the second time? Is it because the live.com (called "Outlook Mail" on the website) has a huge ammount of elements to search through? Is it something with the JavaScript they are using?
I've been able to duplicate this issue with both Firefox and PhantomJS
UPDATE:: I've found this is happening with all of the calls after any page refresh. I can call driver.page_source and I have the same problem. It seems selenium can't interact with the browser for a certain period of time after the page has refreshed. Could it be that selenium is having trouble reading everything off of the web page?
I have seen this happen in my own tests, but on an intermittent basis, and never completely reproducible. What seems to happen is that Selenium WebDriver just becomes blocked and unresponsive.
I know that I have just had to resort to rescuing the error, logging, and retrying in my code. After a few retrys, Selenium WebDriver seems to become responsive again and I'm able to continue on in my tests from there.
I have contacted the maintainer of the Ruby WebDriver gem, and he needs a reproducible test to be able to do some solid debugging. If you are able to provide a reproducible test case, please share it with us so that we can look into this issue. You can use this gist as a starting point to share with the community.
The problem just magically disappeared. It's not happening anymore and I can't duplicate it. Best of luck to the selenium crew finding it, it seems to come and go randomly.

Resources