sharmel / browsershots

Automatically exported from code.google.com/p/browsershots
0 stars 0 forks source link

Tweaks needed to certain browser .py files (windows) #20

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
1) Firefox 5 and Safari 5 don't scroll for me so had to amend the .py files 
(this is for the windows files).
2) Non scrolling of IE8 has already been fixed in issue 12.
3) They've changed the ini file name, the location of the app data folders and 
names of dialog boxes in Opera 11.5 (phew!), so the original .py file doesn't 
disable the cache recovery process or clear the cache files.

Firefox 5

I changed this:

    def find_scrollable(self):
        """Find scrollable window."""
        firefox = self.find_window_by_title_suffix(' Firefox')
        return self.get_child_window(firefox)

To this:

def find_scrollable(self):
        """Find scrollable window."""        
        firefox = self.find_window_by_classname('MozillaUIWindowClass')
        return self.find_child_window_by_classname(firefox,'MozillaWindowClass')

Safari 5

I changed this:

    def find_scrollable(self):
        """
        Find the scrollable window.
        """
        hwnd = win32gui.WindowFromPoint((self.width/2, self.height/2))
        for dummy in range(20):
            if not hwnd:
                return None
            if self.verbose >= 3:
                print 'handle', hwnd
                print 'classname', win32gui.GetClassName(hwnd)
                print 'text', win32gui.GetWindowText(hwnd)
                print
            if win32gui.GetClassName(hwnd) == 'WebViewWindowClass':
                return hwnd
            hwnd = win32gui.GetParent(hwnd)

To this:

    def find_scrollable(self):
        """
        Find the scrollable window.
        """
        hwnd = win32gui.WindowFromPoint((self.width/2, self.height/2))
        for dummy in range(20):
            if not hwnd:
                return None
            if self.verbose >= 3:
                print 'handle', hwnd
                print 'classname', win32gui.GetClassName(hwnd)
                print 'text', win32gui.GetWindowText(hwnd)
                print
            if win32gui.GetClassName(hwnd) == 'WebKit2WebViewWindowClass':
                return hwnd
            hwnd = win32gui.GetParent(hwnd)

Opera 11.5

I changed this:

    def reset_browser(self):
        """
        Disable crash dialog and delete browser cache.
        """
        appdata = shell.SHGetFolderPath(0, shellcon.CSIDL_LOCAL_APPDATA, 0, 0)
        profile = os.path.join(appdata, 'Opera*', '*', 'profile')
        self.delete_if_exists(os.path.join(profile, 'cache4'))
        self.delete_if_exists(os.path.join(profile, 'images'))
        self.delete_if_exists(os.path.join(profile, 'opcache'))
        appdata = shell.SHGetFolderPath(0, shellcon.CSIDL_APPDATA, 0, 0)
        profile = os.path.join(appdata, 'Opera*', '*', 'profile')
        self.delete_if_exists(os.path.join(profile, 'cache4'))
        self.delete_if_exists(os.path.join(profile, 'images'))
        self.delete_if_exists(os.path.join(profile, 'opcache'))
        for inifile in glob(os.path.join(profile, 'opera6.ini')):
            if self.verbose:
                print 'Removing crash dialog from', inifile
            ini = IniFile(inifile)
            ini.set('State', 'Run', 0)
            ini.set('User Prefs', 'Show New Opera Dialog', 0)
            ini.save()

To this:

    def reset_browser(self):
        """
        Disable crash dialog and delete browser cache.
        """
        appdata = shell.SHGetFolderPath(0, shellcon.CSIDL_LOCAL_APPDATA, 0, 0)
        profile = os.path.join(appdata, 'Opera', 'Opera')
        self.delete_if_exists(os.path.join(profile, 'cache4'))
        self.delete_if_exists(os.path.join(profile, 'images'))
        self.delete_if_exists(os.path.join(profile, 'opcache'))
        appdata = shell.SHGetFolderPath(0, shellcon.CSIDL_APPDATA, 0, 0)
        profile = os.path.join(appdata, 'Opera', 'Opera')
        self.delete_if_exists(os.path.join(profile, 'cache4'))
        self.delete_if_exists(os.path.join(profile, 'images'))
        self.delete_if_exists(os.path.join(profile, 'opcache'))
        for inifile in glob(os.path.join(profile, 'operaprefs.ini')):
            if self.verbose:
                print 'Removing crash dialog from', inifile
            ini = IniFile(inifile)
            ini.set('State', 'Run', 0)
            ini.set('User Prefs', 'Show Default Browser Dialog', 0)
            ini.set('User Prefs', 'Show Setupdialog On Start', 0)
            ini.set('User Prefs', 'Show Startup Dialog', 0)
            ini.set('User Prefs', 'Startup Type', 2)
            ini.save()

Original issue reported on code.google.com by telboy...@gmail.com on 8 Aug 2011 at 1:12

GoogleCodeExporter commented 8 years ago
I assume you aren't able to check this code in so we have to do the changes 
manually?

Original comment by doug.mar...@gmail.com on 6 Jan 2012 at 5:47

GoogleCodeExporter commented 8 years ago
No, I'm not. But then not everyone might want these changes, and it may change 
again in the future! :)

Original comment by telboy...@gmail.com on 6 Jan 2012 at 9:07

GoogleCodeExporter commented 8 years ago
IE8 is handled in issue 12 
(http://code.google.com/p/browsershots/issues/detail?id=12)

Has anyone figured a way to enable scroll_down on windows instead of relying on 
the "down arrow" key method. I am able ot replace it with page down but that 
also doesn't quite work right for me and my website.

Original comment by doug.mar...@gmail.com on 10 May 2012 at 9:34