Code Monkey home page Code Monkey logo

Comments (8)

hepivax avatar hepivax commented on May 23, 2024

Hi NickAb,
Can you add an example that checks if ToggleState is On/Off?

Thanks,
hepivax

from winium.mobile.

NickAb avatar NickAb commented on May 23, 2024

Examples on how to read current toggle state can be found in tests and in wiki

element = self.driver.find_element_by_id("FirstToggleAppBarButton")
start_state = self.driver.execute_script("automation: TogglePattern.ToggleState", element)

from winium.mobile.

hepivax avatar hepivax commented on May 23, 2024

I've tried to use it, but I get "unknown script command" exception, any ideas?

section_expand_state = self.desktop.execute_script("automation: TogglePattern.ToggleState", section_expand) File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 465, in execute_script 'args': converted_args})['value'] File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 236, in execute self.error_handler.check_response(response) File "C:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 192, in check_response raise exception_class(message, screen, stacktrace) WebDriverException: Message: Unknown script command 'automation: TogglePattern.ToggleState'. See https://github.com/2gis/Winium.Desktop/wiki/Command-Execute-Script#use-ui-automation-patterns-on-element for supported commands.

from winium.mobile.

NickAb avatar NickAb commented on May 23, 2024

Do you use StoreApps or Silverlight version of InnerServer? What version of Driver.exe and InnerServer do you use?

from winium.mobile.

hepivax avatar hepivax commented on May 23, 2024

I'm sorry I didn't notice that this issue is related to Winium.Mobile.
I'm using Winium.Desktop server v1.6.0.
Is this fuctionality is planed to be added to the next desktop version?

from winium.mobile.

NickAb avatar NickAb commented on May 23, 2024

With Winium.Desktop you can simple use IsElementSelected to check if element is selected or toggled on. And to switch a state of an element you can try using Click command.
Maybe @skyline-gleb can provide more details.

from winium.mobile.

hepivax avatar hepivax commented on May 23, 2024

Thanks, works well for me.

from winium.mobile.

hepivax avatar hepivax commented on May 23, 2024

Hi @skyline-gleb,
I'm trying to check element is in read only state - how can I do that?
image

from winium.mobile.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.