elisarver / selophane Goto Github PK
View Code? Open in Web Editor NEWRepository for the selophane project (see the README.md file for details)
License: Other
Repository for the selophane project (see the README.md file for details)
License: Other
It would be useful to get the name of the interface if the annotion is missing.
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()
.
Some of the javadoc is not aligned well in the Table interface.
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!
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?
It would be great if the content of http://elisarver.com/2012/12/09/wrapping-webelement-1 and http://elisarver.com/2012/12/10/wrapping-webelement-2 become part of documentation in the wiki. Or if not so easy to do, the links should be part of the Readme.md
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
?
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.
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.
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
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.
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);
}
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?
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.