Giter VIP home page Giter VIP logo

selophane's People

Contributors

dependabot[bot] avatar elisarver avatar harrismav avatar opensource21 avatar silversteven avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

selophane's Issues

The field ElementImpl.element shouldn't get a proxy

If we have a fragment which must extend ElementImpl, then field element shouldn't be wrapped again as a proxy, because searching for element can't work.

You can see the problem at org.selophane.elements.FormTest.selectWiredProperly().

Can't launch browser with Selenium 4

Hi Eli, thanks for the library. I was really hoping to use this for a proof-of-concept project I am looking to make using Selenium-4 but I see that the current version fails to launch the browser.

It throws java.lang.NoClassDefFoundError: org/openqa/selenium/federatedcredentialmanagement/HasFederatedCredentialManagement error.

Could you please update the project to use current Selenium version. Thanks!

Can we avoid to create an interface for new Element?

Hi,

First, I want to thank you for your project. It was exactly what I'm looking for since few month. It's seems crazy that features as modify the FindBy behavior are not explained or implemented by Selenium team.

I tested your work, and it works pretty fine.

Here my question. I found verbose the fact to create an interface for each new element I created. Do you think it will be possible to avoid it?

How to extend more details in WebElement type?

@elisarver @opensource21 ,

Thanks for sharing great extending custom WebElement project.

I would like to ask help from you on how to extend more detail on WebElement, if I can get some help from you it would be great help to me.

I would like a add a element's description field to describe the element so that it can be used in test report and make test report more detail and easier to track if fail.

for example, add a String field to Element:

public interface Element extends WebElement, WrapsElement, Locatable {
    String description;
    boolean elementWired();

    void setDescription();
    String getDescription();
}

Then add a new annotation @Description works with @FindBy:

public class LoginPageObjs {
    ...
    @FindBy(name = "submit")
    @Description("Login Page: [Submit] Button")
    public Element submitButton;
}

so that, we can use element's description to log test operation in more detail:

public void click(Element e) {
    e.click();
    // log test operation to test report, for example ReportNG
    reporter.log("Click: " + e.getDescription())     //"Click : Login Page - [Submit] Button" will be logged to test report
}

I would like to know, how to initialise @Description to the Element object by PageFactory.initElements method and ElementFieldDecorator.java?

Select should not accept disabled or invisible options

For

<select id="option1">
    <option value="option1">option1</option>
    <option value="option2">option2</option>
    <option value="option3" disabled="disabled">Disabled option</option>
    <!-- An invisible option is handled different by different browser, so no relevant test -->
    <option value="option4" style="visibility: hidden;">Option hidden</option>
    <!-- An none-displayed option is handled different by different browser, so no relevant test -->    
    <option value="option5" style="display: none;">Option display none</option>
</select>

the option3 throw an InvalidElementStateException.

Improve initialization of a page or a component

I was a little bit confused why in the test-example we get the page with

    public static FormTestObject initialize(WebDriver driver) {
        return ElementFactory.initElements(driver, FormTestObject.class);
    }

?

It implies that someone could instantiate the Page without call initElements, which seems like a bad idea.

I think it would be smarter to put into the constructor
ElementFactory.initElements(driver, this);

If this correct, I wonder why there is no base-class Component, which encapsulate the SearchContext and do the initialization.

I could make the refactoring if the idea is accepted.

Package dependencies

Hi,
the package dependencies are not very clean. First we have a cycle between the interfaces and the implementation. Furthermore a user must reference an internal package.
Shall we put the widget stuff in one package org.selophane.elements and the elementfactory in a package org.selophane.factory?

We could then subpackages elements.base (contains Element, ElementImpl and ImplementedBy) and elements.widgets (Contains conrete widgets).

org.selophane.factory could have an api(contains Elementfactory) and internal package.
Niels

ElementDecorator should not only decorate classes from package selophane

In org.selophane.elements.impl.internal.ElementDecorator.proxyForListLocator(ClassLoader, Class<T>, ElementLocator) there is the following if-statement if (interfaceType.getName().startsWith("org.selophane")) {
I think it should be if (interfaceType.getAnnotation(ImplementedBy.class) != null) {.
Otherwise it's difficult to write your own implementations.

Unable to extend widgets and reference their methods

I have added some additional functionality to the Table implementation to allow for sorting headers.
I felt it wasn't necessary to put it in the interface since not all tables have sortable header. However when initializing the Table object using initElements, I can't cast or call the implementing classes method. Getting ClassCastException

@FindBy(id = "table2")
Table sortableTable;

@Test
public void testClickColumnToSort() {
    TableTest testPage = ElementFactory.initElements(driver, TableTest.class);
    //Note: sortableTable is interface, but we need the implementations method "clickColumnToSort,
    //so trying to cast it throws ClassCastException
    TableImpl base = (TableImpl) testPage.sortableTable;
    base.clickColumnToSort(1);
}

Method to get all css-classes

In many elements I wan't to figured out something about the state of an element. For example the MenuItem should be highlighted. So I want to check the existance of the css-class "active".
I wrote a method

/**
 * Get a list of name of classes, which stands in the attribut class.
 */
protected final List<String> getClasses() {
    final String classAttribute = this.getAttribute("class");
    if (StringUtils.isEmpty(classAttribute)) {
        return new ArrayList<>();
    }
    final String[] primitiveList = classAttribute.split(" ");
    return Arrays.asList(primitiveList);
}

which I added to ElementImpl. Is it possible to get this into selophane or how would you solve it?

Element returns different element memory from driver.findElement(By)

When an element is created using the factory, it is a different element from driver.findBy.

Example code:
@findby(xpath = "//xx")
Element myElement

Init the driver page using the factory and navigate to your element.

This should return true:
myElement.equals(driver.switchTo().activeElement());

However, its false. If I use this example in normal selenium it works.

This causes problems when executing scripts.

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.