Code Monkey home page Code Monkey logo

Comments (10)

NickAb avatar NickAb commented on June 20, 2024

XPath locators are not supported yet. Use of x:Name depends on the language you use to write tests.

For example in python one can simple do

from selenium.webdriver.common.by import By

By.XNAME = 'xname'

But in C# standard locators can not be extended that way, so one would something similar to implementation in https://github.com/2gis/Winium.StoreApps/blob/master/Winium/TestApp.Test/Samples/WpDriver.cs#L67

from winium.mobile.

Pranodayd avatar Pranodayd commented on June 20, 2024

@NickAb
I am using java.How can I use Xname locator strategy in Java?

from winium.mobile.

NickAb avatar NickAb commented on June 20, 2024

I do not know for sure, but this https://mguillem.wordpress.com/2011/10/06/webdriver-subclass-the-by-class-to-define-own-locators/ might help

from winium.mobile.

Pranodayd avatar Pranodayd commented on June 20, 2024

Hi @NickAb
Can I get value of Xname property using getAttribute() function?

from winium.mobile.

NickAb avatar NickAb commented on June 20, 2024

Yes, it should be exposed as xname attribute

from winium.mobile.

Pranodayd avatar Pranodayd commented on June 20, 2024

Ok.Thanks.I will try using this technique then.

from winium.mobile.

Pranodayd avatar Pranodayd commented on June 20, 2024

@NickAb
getAttribute("xname"); returning me a null.
Why?Any idea?

from winium.mobile.

NickAb avatar NickAb commented on June 20, 2024

@Pranodayd, sorry, I misread your question. What I meant is that x:Name set in XAML can be obtained as a value of xname attribute of XML element when using pageSource command.


Here is the answer to you original question:
When using getAttribute command x:Name might be accessed using Name property, e.g.

element.getAttribute("Name")

Note that accessing Name property would require at least DependencyProperties access level set in commandSettings.elementAttributeSettings.accessModifier capability, it won't be accessible if AutomationProperties level is explicitly set. You should be all set by default if you have not specified this capability at all.

from winium.mobile.

NickAb avatar NickAb commented on June 20, 2024

@Pranodayd where you able to find elements by x:Name?

from winium.mobile.

Pranodayd avatar Pranodayd commented on June 20, 2024

@NickAb
Yes I could locate the element by x:Name.Thanks

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.