How to use maximizewindow method in pyatom

Best Python code snippet using pyatom_python

driver.py

Source:driver.py Github

copy

Full Screen

1try:2 import selenium3except ImportError:4 raise ImportError("As root Install python-selenium by running: 'pip install selenium'")5import os6import time7import express8from frlog import LOG9from selenium import webdriver10from selenium.common.exceptions import WebDriverException11from selenium.webdriver.common.desired_capabilities import DesiredCapabilities12class Driver(object):13 """14 Wrapper for Selenium Remote WebDriver class.15 """16 def __init__(self, driverHostname, driverPort, browser, maximizeWindow=True):17 """18 @param driverHostname: Host name on which instance of Remote WebDriver is running.19 Ex. 'mvm-win35'20 @param driverPort: Port number which WebDriver is communicating over. Ex. 444421 @param browser: Type of browser which is open by WebDriver: 'firefox' or 'chrome'.22 @param maximizeWindow: If True (default), maximize newly opened window in browser.23 """24 LOG.info('Instantiating Mangal.Driver...')25 self.driverHostname = driverHostname26 self.driverPort = driverPort27 self.browser = browser28 self.timeout = 1029 self.delay = .330 self._maximizeWindow = maximizeWindow31 self._start()32 def _start(self):33 self.capabilities = None34 if self.browser == 'firefox':35 self.capabilities = DesiredCapabilities.FIREFOX.copy()36 elif self.browser == 'chrome':37 self.capabilities = DesiredCapabilities.CHROME.copy()38 else:39 raise FailedConfigException('Unsupported type of browser:', browser)40 self.webDriver = webdriver.Remote(command_executor='http://%s:%s/wd/hub' %41 (self.driverHostname, self.driverPort), desired_capabilities=self.capabilities)42 if self._maximizeWindow:43 self.maximizeWindow()44 def getWebDriver(self):45 return self.webDriver46 def forward(self):47 LOG.l4('Navigating forward in browser history')48 self.webDriver.forward()49 def back(self):50 LOG.l4('Navigating back in browser history')51 self.webDriver.back()52 def close(self):53 LOG.l4('Closing browser active window')54 try:55 self.webDriver.close()56 except WebDriverException, e:57 LOG.l4('WebDriver.close():', e.msg)58 def quit(self):59 LOG.l4('Quitting WebDriver')60 try:61 self.webDriver.quit()62 except WebDriverException, e:63 LOG.l4('WebDriver.quit():', e.msg)64 def maximizeWindow(self):65 """66 Maximize browser's active window67 """68 self.webDriver.maximize_window()69 def takeScreenshot(self, name):70 """71 Save screenshot of active web page to PNG file.72 @param name: Name of screenshot file.73 """74 if LOG.getLogDir() is not None:75 logDirectory = LOG.getLogDir()76 else:77 logDirectory = os.getcwd()78 pathFileName = os.path.join(logDirectory, name + '.' +79 express.getUnixTime(formatstr='%Y%m%d_%H%M%S') + '.png')80 self.webDriver.save_screenshot(pathFileName)81 LOG.l4("Mangal.Driver: takeScreenshot(): Saved into '%s'" % pathFileName)82 def setBrowser(self, browser):...

Full Screen

Full Screen

title_bar.py

Source:title_bar.py Github

copy

Full Screen

1from qt_core import *2from builder.template_app.gui.content import *3from builder.template_app.gui.functions.settings import Settings4from builder.template_app.gui.functions.ui_functions import UIFunctions5class TitleBar(QWidget):6 def __init__(self, parent=None):7 super(self.__class__, self).__init__(parent)8 #self.setupUi(self)9 self.ui = parent10 settings = Settings('ui')11 self.settings = settings.items12 settings = Settings('theme')13 self.theme_settings = settings.items14 #self.icon = QIcon()15 self.icon_color = self.theme_settings['theme']['titlebar']['icons']16 17 self.ui.appTitle.setText(self.settings['window']['app_name'])18 self.ui.appDescription.setText(self.settings['window']['description'])19 self.ui.appLogo.setPixmap(QPixmap(UIFunctions().resource_path(self.settings['window']['icon'])))20 21 if not self.settings['window']['frameless']:22 self.ui.windowicons.hide()23 else:24 icon = qta.icon("msc.chrome-maximize", color=self.icon_color)25 self.ui.maximizewindow.setIcon(icon)26 icon = qta.icon("msc.chrome-close", color=self.icon_color)27 self.ui.closewindow.setIcon(icon)28 icon = qta.icon("msc.chrome-minimize", color=self.icon_color)29 self.ui.minimizewindow.setIcon(icon)30 31 32 self.ui.maximizewindow.clicked.connect(self.icon_maximize_restore) 33 self.ui.minimizewindow.clicked.connect(self.ui.window().showMinimized)34 self.ui.closewindow.clicked.connect(self.ui.window().close)35 self.ui.appDescription.mouseDoubleClickEvent = self.dbclick_maximize_restore36 def icon_maximize_restore(self):37 self.ui.window().showMaximized38 button = self.sender()39 40 if self.ui.window().isMaximized():41 icon = qta.icon("msc.chrome-maximize", color=self.icon_color)42 button.setIcon(icon)43 self.ui.window().showNormal()44 else:45 icon = qta.icon("msc.chrome-restore", color=self.icon_color)46 button.setIcon(icon)47 self.ui.window().showMaximized()48 49 def dbclick_maximize_restore(self, event=None):50 if self.settings['window']['frameless']:51 QTimer.singleShot(0, self.ui.maximizewindow.clicked.emit)...

Full Screen

Full Screen

006_maximizeWindow.py

Source:006_maximizeWindow.py Github

copy

Full Screen

1# -*- coding: utf-8 -*-2# ***************************************************3# @Test Case ID: 006_maximizeWindow4# @Test Description: MaximizeWindow(win uint32),最大化给定id的窗口实例,首先会调用ActivateWindow激活窗口再使之最大化5# win: 请参考ActivateWindow函数的win参数6# @Test Condition: 1.打开一个文件管理器窗口7# 2.获取文件管理器的窗口id8# @Test Step: 1.调用 MaximizeWindow 函数,传入文件管理器的窗口id9# @Test Result: 1.程序无报错10# @Test Remark:11# @Author: ut00162712# ***************************************************13import time14import subprocess15import pytest16from frame.base import OSBase17from aw.dbus.sessionBus import dock18class TestCase(OSBase):19 def setUp(self):20 self.Step("预制条件1:打开一个文件管理器窗口")21 self.p = subprocess.Popen('dde-file-manager')22 time.sleep(5)23 self.win_id = dock.get_window_id_by_name()24 time.sleep(1)25 @pytest.mark.public26 def test_step(self):27 self.Step("步骤1:调用 MaximizeWindow 函数,传入文件管理器的窗口id")28 dock.maximizeWindow(self.win_id)29 def tearDown(self):30 self.Step("收尾:关闭文件管理器子进程")31 self.p.kill()...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run pyatom automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful