Home > other >  Appium TypeError: in Common () takes no arguments
Appium TypeError: in Common () takes no arguments

Time:10-23

This is the code:

The from baseView. BaseView import baseView
The from common. Desired_caps import appium_desired
The from selenium.com mon. Exceptions import NoSuchElementException
The from appium import webdriver
The import of logging
The from selenium.webdriver.com mon. By the import by
The import time, OS


The class Common (BaseView) :
CancelBtn=(By ID, 'com. Android. Packageinstaller: ID/permission_allow_button')
SkipBtn=(By ID, 'com. Tal. Kaoyan: ID/tv_skip')

Def check_cancelBtn (self) :
Logging. The info (' -- -- -- -- -- -- -- -- -- -- check_cancelBtn -- -- -- -- -- -- -- -- -- -- -- -- ')
Try:
CancelBtn=self. Driver. Find_element (* self. CancelBtn)
Except NoSuchElementException:
Logging. The info (' no cancelBtn ')
The else:
CancelBtn. Click ()

Def check_skipBtn (self) :
Logging. The info (' -- -- -- -- -- -- -- -- -- -- check_skipBtn -- -- -- -- -- -- -- -- -- -- -- -- ')
Try:
SkipBtn=self. Driver. Find_element (* self. SkipBtn)
Except NoSuchElementException:
Logging. The info (' no skipBtn ')
The else:
SkipBtn. Click ()

Def get_window_size (self) :
X=self. Driver. Get_window_size () [' width ']
Y=self. Driver. Get_window_size () [' height ']
Return the x, y

Def swipeLeft (self) :
Logging. The info (' swipeleft ')
L=self. Get_size ()
X1=[0] * 0.9 (l)
Y1=[0] * 0.5 (l)
X2=[0] * 0.1 (l)
Self. Swipe (x1, y1, x2, y1, 2000)

Def getTime (self) :
Self. Now=time. Strftime (' % % Y - m - m - H - % d % % % S ')
Return the self. Now

Def getScreenShot (self, the module) :
Time=self. GetTime ()
Image_file=OS. The path. The dirname (OS) path) dirname (__file__)) + 's_/screenshots/% % supachai panitchpakdi ng' % (module, time)

Logging. The info (' screenshot get % s' % module)
Self. Driver. Get_screenshot_as_file (image_file)


If __name__=="__main__ ':
Driver=appium_desired ()
Com=Common (driver)
Com. Check_cancelBtn ()
Com. Check_skipBtn ()


This is an error:

/usr/local/bin/python3.7/Users/pei/PycharmProjects kyb_testProject/common/common_fun py
/Users/pei/PycharmProjects kyb_testProject/common/desired_caps py: 15: YAMLLoadWarning: calling yaml. The load () without Loader=... Is deprecated, as the default Loader is unsafe. Both Please read https://msg.pyyaml.org/load for full details.
The 2019-05-31 16:20:24, 649 desired_caps. Py [32] line: INFO start app...
Data=https://bbs.csdn.net/topics/yaml.load (file)
Traceback (the most recent call last) :
Pei in the File "/Users//PycharmProjects/kyb_testProject/common/common_fun py", line 61, in & lt; module>
Com=Common (driver)
TypeError: Common () takes no arguments



Why is this so? Torture me for a long time

CodePudding user response:

I had a similar error:
The from baseView. BaseView import baseView: inside the script writing wrong view changes carefully
  • Related