'WebDriver' object has no attribute 'w3c' when running execute_script

Hello, yesterday I update to the latest appium-python client and immediately got test failures when running:

self.driver.execute_script(“mobile: scroll”, {“direction”: “down”, “text”: user})

The error is below. Any help is appreciated.

def execute_script(self, script, *args):
“”"
Synchronously Executes JavaScript in the current window/frame.

    :Args:
     - script: The JavaScript to execute.
     - \*args: Any applicable arguments for your JavaScript.

    :Usage:
        driver.execute_script('return document.title;')
    """
    converted_args = list(args)
    command = None
  if self.w3c:

E AttributeError: ‘WebDriver’ object has no attribute ‘w3c’

I also tried the following code using the w3c actions suggested on the python-client git, but I still got the same error. This time is when getting window_size()

Code:
def scroll_down(self):
window = self.__appium_driver.get_window_size()
actions = ActionBuilder(self.__appium_driver)
actions.pointer_action.move_to_location(window.width / 2, window.height * 8 / 10)
actions.pointer_action.pointer_down()
actions.pointer_action.move_to_location(window.width / 2, window.height / 10)
actions.pointer_action.release()
actions.perform()

Error:
def get_window_size(self, windowHandle=‘current’):
“”"
Gets the width and height of the current window.

    :Usage:
        driver.get_window_size()
    """
    command = Command.GET_WINDOW_SIZE
  if self.w3c:

E AttributeError: ‘WebDriver’ object has no attribute ‘w3c’

Here is the documentation for the Python Client:

There is a section on migration from v1 to v2 that states:

Deprecated
MultiAction and TouchAction are deprecated. Please use W3C WebDriver actions.
e.g.
appium/webdriver/extensions/action_helpers.py
/documentation/webdriver/actions_api/mouse/
https://www.youtube.com/watch?v=oAJ7jwMNFVU
Appium Pro: iOS-Specific Touch Action Methods
Appium Pro: Automating Complex Gestures with the W3C Actions API
launch_app, close_app and reset are deprecated. Please read issues#15807 for more details

Does that help?

Thank you wreed. I did read that and one of the links there shows that execute_script should still work(?)
https://appiumpro.com/editions/30-ios-specific-touch-action-methods

My last post also shows the actionbuilder method snippet for scrolling, but I’m still using get_window_size() and that gives me the error.

I would like to find a way to do this without having to back to v1.

Yeah, this is confusing to me too. I’m not a Python guy. I’m looking at the client repo tests:

Seems like they are using ‘self.execute_script’ instead of ‘self.driver.execute_script’. I probably don’t understand the difference though.

I also wonder if in your first script you might try: if self.driver.w3c. But I’m not sure about this.

1 Like

I assume this might be an issue with the selenium’s python client. The one in Appium does not have such attribute defined nor override any of the mentioned methods.

1 Like

Thank you both. I am going to crosspost this to the python-client git and see if it is a bug on their end
Alex

I assume this issue can be fixed by updating the selenium to 4.0.0, I had an issue using driver.get_window_size() & the update fixed it

1 Like