Giter VIP home page Giter VIP logo

selenium-page-object-generator's People

Contributors

bartonhammond avatar jpvantuyl avatar rickypc 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

selenium-page-object-generator's Issues

checkboxes in fill()

Checkboxes cannot be currently defined via data and simply checking all in fill() is usually undesired. Please either make them settable via data or take them out of the fill() method.

Access anchors by link text, not href

In many dynamic applications the link targets change with query params because of session IDs, JavaScript, search params etc.

I think, in most cases it would be better to locate anchors by their containing text (or at least the first words of it) using XPath.

Utilizing aria label

We use aria label as an automation hook in every element so that minor changes in id/x-ptah/css of an element will not break our test cases. Ho wto get priority to aria-label while generating the page?

No result for infinite time.

No result for infinite time.

Hi guys.

Thanks for the great product! Just came across your plugin today. Was happy to see it and install.
Unfortunately, the plugin did not generate any results for most page. Actually I was not able to get results for some pages. Here is the page I was able to produce results: http://demoqa.com/
This page did not produce any results: https://en.wikipedia.org/wiki/Main_Page

Please make let us know if you have time to check the issue and fix.
By the way there are few 'reviews' stating the same problem.

Thanks!

Page objects inside shadow root

Looks like current version of page object generator is not traversing the nodes inside shadow root to create page objects. Do you have plan to support this feature?

Default Java class should compile

I'm missing two import statements in the Java handlebars code.

I get this error when compiling (via Maven):

[ERROR] /c:/path/to/src/main/java/PageObjectModel/SomeFolder/SomeClass.java:[149,56] cannot find symbol
[ERROR] symbol:   class ExpectedCondition
[ERROR] location: class PageObjectModel.SomeFolder.SomeClass
[ERROR] /c:/path/to/src/main/java/PageObjectModel/SomeFolder/SomeClass.java:[149,14] cannot find symbol
[ERROR] symbol:   class WebDriverWait
[ERROR] location: class PageObjectModel.SomeFolder.SomeClass

Adding the two following import statements allows it to compile:

import org.openqa.selenium.support.ui.WebDriverWait;
import org.openqa.selenium.support.ui.ExpectedCondition;

Error in event handler: not a valid selector

My application has following HTML element:

<a href="javascript:__doPostBack('ctl00$maincontent$FunctionalityProjektTabContainer$KorespondencjaTabPanel$KorespondencjaTab$KorespondencjaTabContainer$PrzychodzaceTabPanel$PrzychodzaceControlGrid$KorespondencjaGridView','Sort$NumerOdbiorcy')">Numer pisma</a>
While trying to save page object nothing is generated and following error is visible on Javascript console:

extensions::uncaught_exception_handler:8 Error in event handler for runtime.onMessage: SyntaxError: Failed to execute 'querySelectorAll' on 'Document': 'a[href='javascript:__doPostBack('ctl00$maincontent$FunctionalityProjektTabContainer$WnioskiPlatnoscTabPanel$WnioskiPlatnoscTab$UmowyGridView$ctl03$WnioskiOPlatnoscGridView','Sort$NumerWniosku')']' is not a valid selector.

Command line version support (nodejs preferred)

Hi Richard,

I have installed this extension and loved it.

This works great as an browser extension. However I want to run this from command prompt as a node.js script. The extension uses the page that is already loaded, for the command prompt version, I want to provide a HTML source file instead. I should also have option to provide argument as JAVA/C#/ROBOT. The command line arguments should be something like this:

$node page_test_generator.js input.html JAVA

I am good in Nodejs, so if you please provide me what all files I have to change to achieve my requirement, I will fork your branch and do the changes. If it is easy for you to do above changes that would be great otherwise I will make changes as per your guidance.

Thanks!

Best Regards,
Balram

Variables named as a language keyword

When generating a page for Java, one of the variable names was "import", which conflicts with the Java import keyword. I had to manually go through the file and change the name of all instances of the variable.

Probably need a constructor as well

Don't this generated page need the constructor with below code in any class that it generates?

{
this.driver = browser;
PageFactory.InitElements(browser, this);
}

Firefox port?

Hi,
Have you thought about porting this to Firefox?

Incorrect naming convention

It names the variables a little incorrectly.. For instance it names them debianaUsernamePassword1 and debibanaUsernamePassword2, but a correct name would be debianaUsername and debianaPassword.. attached image of html and code in c#..

image

For some reason
image

After 15 minutes, no java file generated (chrome plugin)

Hi,

I have a page with large form in a table layout. Within the form reside complex rows with different column counts that include several input elements, select elements, and 20 check boxes. Within the top row are columns that contain nested rows. The nested columns are scrollable.

The select elements are populated via ajax scripts.
Some input elements are partially populated via an autofill javascript.
There are also several hidden input element.
There is a submit button and a "clear form" implemented as an input (I didn't write this)
Also, there are several tool tips implemented in javascript that hook the mouseover..

After running for 15 minutes, the plugin closes and no file (java) is created.

Is there a way to have this form complete and generate a java file ?

Need help running from command line

Per Readme, I entered gulp - I don't see any build or dist

Loading Modules: 1701.695ms
[14:48:54] Using gulpfile ~/projects/wisnet/gitProjects/selenium-page-object-generator/gulpfile.js
[14:48:54] Starting 'clean'...

Ability to exclude some WebElements?

Hello,

This project is awesome, thank you.
One problem I'm having is that my webSite has a scrollable text field for checkbox's, they are all prefixed with cat_someLongId

When I generate this page, it's generating around 7,000 elements that I dont need... and impossible to clean up.

Is there any way i can exclude based on some text or prefix_string?

Thanks

perhaps feature request

When the generator is running under chrome, it seems that if you perform any other action on the computer, clicking the mouse anywhere, the generator just closes. Is there an option for it to continue to run in the background?

Field Naming

I posted this in the google store page, but thought I would but it here after looking at your code. It seems to be an issue in the getSanitizedText method.

Your plugin saves me a lot of effort on most pages, but I have a problem with the naming of fields in the generated C#. We have some dynamic questionnaires and the items are labeled by the question number followed by the question text. eg.

<label id="LS1.0Q1.0" for="S1.0Q1.0" class="LC1"><b>1.1</b> What is the legal name of your  Company?</label><br/>
<input id="S1.0Q1.0" name="S1.0Q1.0" class="Answered" value="11b" required type="text"/>

which results in a field:

[FindsBy(How = How.Id, Using = "S1.0Q1.0")]
[CacheLookup]
private IWebElement 11WhatIsTheLegalName;

The 11 at the front of the name gives a syntax error for each question. We can have 40 questions per page and 40 pages for a questionnaire so fixing this manually is a big effort.

Is there a way to change this behavior?

Bad code generated

Tried plugin; it generates some bad code.

  1. clickl method out of nowhere followed by invalid java code.
    /**
    * Submit the form to target page.
    *
    * @return the GoogleHomePage class instance.
    */
    public GoogleHomePage submit() {
    clickI'mFeelingLuckyButton();
    return this;
    }
  2. WebDriverWait, ExpectedCondition

If necessary I can post the code, or you can simply go to google.com and run the plugin to generate a java page object model class.

Documentation

The links on how to use this tool are not working. Is there any way that you could update them or make some kind of documentation/tutorial?

Check data for key existence before using

Before using data.get(foo) we should look up if the key exists in the map and in case it doesn't do nothing in the default setters. I've changed my own Java template to something like this:

/**
* {{#if argument}}{{argument.documentation}}{{else}}{{operation.documentation}}{{/if}}
*
* @return the {{default target.modelName @root.model.name}} class instance.
*/
public {{default target.modelName @root.model.name}} {{operation.name}}() {
{{#if argument}}
{{#unequals type 'radio'}}
    if (data.containsKey("{{argument.key}})")) {
        return {{operation.name}}(data.get("{{argument.key}}"));
    } else {
        return this;
    }
}

TypeError: Cannot read property 'close' of undefined

I did install w/ npm install selenium-page-object-generator

Run time:

/projects/wisnet/gitProjects/temp$ node_modules/.bin/selenium-page-object-generator -t java -n MySite -s source.html
(node:49793) DeprecationWarning: 'GLOBAL' is deprecated, use 'global'
/Users/barton/projects/wisnet/gitProjects/temp/node_modules/selenium-page-object-generator/bin/generate.js:100
            window.close();
                  ^

TypeError: Cannot read property 'close' of undefined
    at Object.done (/Users/barton/projects/wisnet/gitProjects/temp/node_modules/selenium-page-object-generator/bin/generate.js:100:19)
    at reportInitError (/Users/barton/projects/wisnet/gitProjects/temp/node_modules/jsdom/lib/jsdom.js:384:12)
    at ReadStream.resourceLoader.readFile (/Users/barton/projects/wisnet/gitProjects/temp/node_modules/jsdom/lib/jsdom.js:161:9)
    at emitOne (events.js:96:13)
    at ReadStream.emit (events.js:188:7)
    at fs.js:1956:12
    at FSReqWrap.oncomplete (fs.js:123:15)
~/projects/wisnet/gitProjects/temp$ 

Filter option to retrieve part/section of the Webpage Objects

I am lacking experience and knowledge in using this plugin in Chrome to customise it for my purpose and hence need some help to figure out if some filter operation is possible with this tool.

Requirement & Problem: My page is so complex that this plugin generates 5000 lines of code from just one page with the default filter available. But I need to filter and retrieve only the page objects from the code block/ division block (a table) with HTML id = "navi_tree".

Solution needed: What should be the filter criteria under 'Root Selector' in the options window? Or is there any other filter method that works for my requirement.

Note: If a Guideline document is available for this plugin, kindly share it's web-link for understanding and usage purpose.

support for typescript

With the rise of javascript and typescript, I suggest that adding support to generate ts files would be a good thing

Only generating "default Collection" frame of a webpage.

Is there a way to cycle through the frames in a tab, currently the generator only pulls out the top level Iframe of one of my sites under test, is there a way around this by specifying a frame? I cannot attach screenshots unfortunately due to confidentiality.

Using Options & root selector, error w/ document.querySelectorAll

I'm trying to ignore a large section of the page so using the Options, I set the 'root' as div#primary and left the selectors as can be seen in the image below.

screen shot 2017-12-14 at 6 58 37 pm

and here is the object input parameter to the function setDefinitions(input)

screen shot 2017-12-14 at 6 48 40 pm

If I try these commands in the console:

screen shot 2017-12-14 at 6 53 59 pm

Error in event handler for runtime.onMessage: SyntaxError: Failed to execute 'querySelectorAll' on 'Document': 'a.btn.btn-default.dropdown-toggle.' is not a valid selector.

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.