TestProject Forum

Testproject-python-sdk AtrributeError has no attribute ‘step_settings’

Hi, below is error message
…\appdata\local\programs\python\python39\lib\site-packages\src\testproject\sdk\drivers\webdriver\base\basedriver.py:155: in pause
self.command_executor.pause(milliseconds)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <src.testproject.sdk.internal.helpers.custom_command_executor.CustomCommandExecutor object at 0x00000186765321F0>, milliseconds = 1000

    def pause(self, milliseconds: int):
        """Pause test execution for the specified duration

        Args:
            self (Union[Remote, BaseDriver]): The driver invoking this pause action.
            milliseconds (int): Number of milliseconds to pause test execution for.
        """

        # Handling sleep before execution
>       self.step_helper.handle_sleep(sleep_timing_type=self.step_settings.sleep_timing_type,
                                      sleep_time=self.step_settings.sleep_time)
E       AttributeError: 'CustomCommandExecutor' object has no attribute 'step_settings'

My OS is Win10 pro, and I have tried ubuntu 18.04.
My python Version is 3.9.2 and I created a venv that only install testproject-python-sdk and pytest.

The magic is that there is no problem running on the Testproject platform.

I have contacted the customer service, but still cannot solve it. Has anyone encountered a similar problem?


Below is code …

from addons.web_extensions import WebExtensions

from selenium.webdriver.common.by import By

from src.testproject.classes import DriverStepSettings, StepSettings

from src.testproject.decorator import report_assertion_errors

from src.testproject.sdk.drivers import webdriver

from src.testproject.sdk.drivers.actions import Actions

import pytest

"""




    Generated on 03/15/2021, 02:40:40

"""

@pytest.fixture()

def driver():

    driver = webdriver.Chrome(token="xxx",

                              project_name="Mobii",

                              job_name="demo")

    step_settings = StepSettings(timeout=2000)

    with DriverStepSettings(driver, step_settings):

        yield driver

    driver.quit()
@report_assertion_errors

def test_main(driver):

    # Test Parameters

    ApplicationURL = "xxxx"  # Auto generated application URL parameter

    # 1. Navigate to '{ApplicationURL}'

    # Navigates the specified URL (Auto-generated)

    driver.get(f'{ApplicationURL}')

    # 2. Click 'IMG4'

    # step_settings = StepSettings(always_pass=True)

    # with DriverStepSettings(driver, step_settings):

    #     img4 = driver.find_element(By.XPATH,

    #                                "//swiper/div/button/img")

    #     img4.click()

    # 3. Set window size to ('760','1020')

    driver.addons().execute(

        WebExtensions.setwindowsize(

            width="760",

            height="1020"))

    # 4. Pause for '1000'ms

    driver.pause(milliseconds=1000)

    # 5. Click 'IMG31'

    img31 = driver.find_element(By.XPATH,

                                "//div[1]/div/div[5]/a//img")

    img31.click()

    # 6. Is 'IMG32' visible?

    img32 = driver.find_element(By.XPATH,

                                "//div/div/a/img")

    assert img32.is_displayed()

    # 7. Click 'IMG9'

    img9 = driver.find_element(By.XPATH,

                               "//a[5]/img[1]")

    img9.click()

Hello @ryan.chen
I have reproduced the issue and opened a bug on it