Answer the question
In order to leave comments, you need to log in
Can't understand Python inheritance?
Good afternoon, I ask for help. How do I access the method in the webdriver.py file (find_element_by_xpath()) through a custom test (MATA455.py) while calling the method in the test like this (
element_1 = self.oHelper.driver.find_element_by_xpath("/html/body/div[1]/div[3]/div[2]/div[1]/div[2]/div/div[1]/div[1]/div[2]/div[2]/div/div[2]/select/option[4]")
) At the same time, to get an object by xpath in the current instance of the test without creating a new window? After that, in the test, you need to click on the element received by XPath webdriver.py- it defines find_element_by_xpath()
base.py- there is imported (
import webdriver
) and the browser driver is defined (self.driver = webdriver.Firefox(firefox_options=options, executable_path=driver_path, log_path=log_path
))main.py- test goes here and WebApp() is defined here
from tir.technologies.core.language import LanguagePack
from tir import Webapp
from tir.technologies.core.base import Base
from tir import Apw
from bs4 import BeautifulSoup
from tir.technologies.core import enumerations
import unittest
class MATA440(unittest.TestCase):
@classmethod
def setUpClass(inst):
inst.oHelper = Webapp()
inst.oBase = Base()
#inst.oApw = Apw()
inst.oHelper.Setup('SIGAADV', '06/08/2019', '00', '102030', '01')
inst.oHelper.Program('MATA455')
def test_MATA455_CT001(self):
self.oHelper.ClickLabel("OMS - управление распред-ем (1)")
self.oHelper.ClickLabel("Заказы (1)")
self.oHelper.ClickLabel("Утверждение запаса")
self.oHelper.ClickComboBox (label_comboBox_name = "Нет ограничений", position=1)
#порядковый номер в комбобоксе
#indexCombo = '4
#путь до комбобокса
#parameter index - порядковый номер строки в комбобоксе на экране
element_1 = self.oHelper.driver.find_element_by_xpath("/html/body/div[1]/div[3]/div[2]/div[1]/div[2]/div/div[1]/div[1]/div[2]/div[2]/div/div[2]/select/option[4]")
self.oHelper.click (element = element_1, click_type = enumerations.ClickType.SELENIUM)
self.oHelper.SetButton(button = "OK")
@classmethod
def tearDownClass(inst):
inst.oHelper.TearDown()
if __name__ == '__main__':
unittest.main()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question