Giter Site home page Giter Site logo

marketsquare / robotframework-angularjs Goto Github PK

View Code? Open in Web Editor NEW
34.0 34.0 20.0 189 KB

An AngularJS and Angular extension to Robotframework's SeleniumLibrary

License: Apache License 2.0

Python 44.73% JavaScript 27.38% RobotFramework 25.61% HTML 2.28%

robotframework-angularjs's Introduction

Torilla Tavataan! Let's meet at the Market Square!

Torilla Tavataan

Let's meet at the Market Square!

Welcome to MarketSquare, a community run collection of repositories for Robot Framework.

See https://marketsquare.github.io/ on how to request access/join the MarketSquare.

For more information about the MarketSquare organization see our FAQ.

robotframework-angularjs's People

Contributors

emanlove avatar kad-derksn avatar tisto avatar zephraph 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

robotframework-angularjs's Issues

Selenium2Library architecture changes

Hi

We are doing some proof on concept work for the Selenium2Library new architecture. The architecture is based on idea to use Robot Framework dynamic library API and remove Selenium2Library multi inheritance from the library. Also we are planning to introduce a context object which would contain information from the current driver/browser. Also we are thinking to introduce a Base class, which could contain example the logging methods and some other common functionality for the library. The Base class would be inherit by other keyword classes, but the idea of the Base class is still little bit in the air and I am not yet sure is it good idea to implement.

The new architecture is based on this idea: https://github.com/robotframework/PythonLibCore and we did get the PoC working for Open Browser and Close All Browsers` keywords. More details about the PoC code can be example found from here: https://github.com/aaltat/robotframework-selenium2library/blob/new_arc/src/Selenium2Library/__init__.py#L179, https://github.com/aaltat/robotframework-selenium2library/blob/new_arc/src/Selenium2Library/keywords/browsermanagement.py#L76 and https://github.com/aaltat/robotframework-selenium2library/blob/new_arc/src/Selenium2Library/keywords/browsermanagement.py#L37

By doing the new architecture we might introduce changes which breaks the AngularJSLibrary support for the Selenium2Library release 2.0. I agree that your idea to extend the Selenium2Library with AngularJSLibrary to support AngularJS is a good idea. Therefore is there something that we could do on the Selenium2Library side, which would make easier for AngularJSLibrary to support Selenium2Library 2.0 release.

Importing test library "AngularJSLibrary" failed

Hi, i just get the lastest Version 0.0.4.dev1, but it is show failed when i import it with ride ,

20160825 09:33:33.842 [WARN]: Importing test library "AngularJSLibrary" failed

Traceback (most recent call last):
Initializing test library 'AngularJSLibrary' with no arguments failed: RobotNotRunningError: Cannot access execution context
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\robotide\lib\robot\running\testlibraries.py", line 184, in _get_instance
return libcode(self.positional_args, *self.named_args)
File "C:\Python27\lib\site-packages\AngularJSLibrary__init
.py", line 148, in init
self.s2l.element_finder = ngElementFinder(ignore_implicit_angular_wait)
File "C:\Python27\lib\site-packages\AngularJSLibrary__init
.py", line 319, in _s2l
return BuiltIn().get_library_instance('Selenium2Library')
File "C:\Python27\lib\site-packages\robot\libraries\BuiltIn.py", line 3040, in get_library_instance
return self._namespace.get_library_instance(name)
File "C:\Python27\lib\site-packages\robot\libraries\BuiltIn.py", line 70, in _namespace
return self._get_context().namespace
File "C:\Python27\lib\site-packages\robot\libraries\BuiltIn.py", line 65, in _get_context
raise RobotNotRunningError('Cannot access execution context')
File "C:\Python27\lib\site-packages\robotide\spec\librarymanager.py", line 81, in _fetch_keywords
return get_import_result(path, library_args)
File "C:\Python27\lib\site-packages\robotide\spec\libraryfetcher.py", line 20, in get_import_result
lib = robotapi.TestLibrary(path, args)
File "C:\Python27\lib\site-packages\robotide\lib\robot\running\testlibraries.py", line 50, in TestLibrary
lib.create_handlers()
File "C:\Python27\lib\site-packages\robotide\lib\robot\running\testlibraries.py", line 109, in create_handlers
self._create_handlers(self.get_instance())
File "C:\Python27\lib\site-packages\robotide\lib\robot\running\testlibraries.py", line 176, in get_instance
self._libinst = self._get_instance(self._libcode)
File "C:\Python27\lib\site-packages\robotide\lib\robot\running\testlibraries.py", line 186, in _get_instance
self._raise_creating_instance_failed()
File "C:\Python27\lib\site-packages\robotide\lib\robot\running\testlibraries.py", line 263, in _raise_creating_instance_failed
% (self.name, args_text, msg, details))

Remove the **MAGIC**

Due to the goal of this library that mirrors Protractor which in turn justifiable claims that "[y]ou no longer need to add waits and sleeps to your test" and "you don’t have to worry about waiting for your test and webpage to sync." everything it accomplishes in this regard feels like MAGIC. This complicates the situation when things don't go as expected. It also downplays the importance of the end users understanding what is going on, what this library can and cannot accomplish.

This ticket lists some of the items I want to change to help remove the magic.

  1. If the library has to poll (more than once, twice, N times) than an info log statement is recorded.
  2. If the library timeouts log that piece of information at info level.
  3. [.. something else that I really can't remember at this time ..]

Update window.angular is undefined error.

Currently the error is

window.angular is undefined. This could be either because this is a non-angular page or because your test involves client-side navigation. Currently the AngularJS Library is not designed to wait in such situations. Instead you should explicitly call the "Wait For Angular" keyword.

For the case where test involves client-side navigation it gives ok information about why one is getting this error (Library is not designed to wait in such situations) and what to do (you should explicitly call the "Wait For Angular" keyword). But for the case where this is a non-angular page we could and should give a hint as to what to do in this case; such as use the ignore implicit angular wait functionality.

Cannot import angularjs library when using the latest version of seleniumlibrary

versions:
robotframework==3.0.2
robotframework-angularjs==0.0.6
robotframework-selenium2library==3.0.0b1

got error

Importing test library 'AngularJSLibrary' failed: ImportError: No module named locators Traceback (most recent call last): File "C:\Python27\lib\site-packages\AngularJSLibrary\__init__.py", line 6, in <module> from Selenium2Library.locators import ElementFinder

downgrade selenium2library can fix it.

SeleniumLibrary has removed Selenium2Library compatibility methods and attributes

SeleniumLibrary 4.0 release will remove the Selenium2Library compatibility methods and attributes. More details in here: robotframework/SeleniumLibrary#1347

This library is using at least this:

self._s2l._current_browser()

Which does not exist anymore in the SeleniumLibrary 4.0. Instead this library should use the new API: https://github.com/robotframework/SeleniumLibrary/blob/master/docs/extending/EXTENDING_SELENIUMLIBRARY.rst

In the above case, could should be changed to:

self._s2l.driver

Application with both angular and nonangular pages

Clicking on a link in non-angular portal goes to angular pages.

Displays ' angular root element' error when clicking on link in non-angular.
Tried even by separating keywords and settings in diff files.

Angular root element not found, but i do not why

I use angular lib with robot framework, but i get this error:
JavascriptException: Message: javascript error: window.angular is undefined. This could be either because this is a non-angular page or because your test involves client-side navigation. Currently the AngularJS Library is not designed to wait in such situations. Instead you should explicitly call the "Wait For Angular" keyword. (Session info: chrome=84.0.4147.105)
so can anybody help me in this?
approot

Resource.Robot File Missing

Hi
I am exploring AngularJS in Robotframework , i came across your repository when i am trying to run the code i am getting an error as 1 file is missing(Resource.Robot). Need your help in this.

Thanks in Advance

Is it supported with AppiumLibrary as well?

Hello, This a query not an issue. I need to automate Smartphone web application built using AngularJs. We have existing framework using Robot Framework and AppiumLibrary which works with non-AngularJs application. So, I just wanted to check that can we import this library with AppiumLibrary to automate mobile web applications.

Override ngElementFinder class doesn't have and _s2l attribute

Didn't see this error before but in an internal application we saw

14:59:06.140    FAIL       AttributeError: 'ngElementFinder' object has no attribute '_s2l'
14:59:06.141    DEBUG
Traceback (most recent call last): File "<decorator-gen-42>",line 2,
in get_text File "C:\Python27\lib\site-packages\Selenium2Library\keywords\keywordgroup.py", line 15,
in _run_on_failure_decorator return method(*args, **kwargs) File "C:\Python27\lib\site-packages\Selenium2Library\keywords\_element.py", line 312,
in get_text return self._get_text(locator) File "C:\Python27\lib\site-packages\Selenium2Library\keywords\_element.py", line 700,
in _get_text element = self._element_find(locator, True, True) File "C:\Python27\lib\site-packages\Selenium2Library\keywords\_element.py", line 678,
in _element_find elements = self._element_finder.find(browser, locator, tag) File "C:\Python27\lib\site-packages\Selenium2Library\locators\elementfinder.py", line 37,
in find return strategy(browser, criteria, tag, constraints) File "C:\Python27\lib\site-packages\AngularJSLibrary\__init__.py", line 29,
in _find_by_default return self._s2l._element_finder._find_by_xpath(browser, criteria, tag, constraints)

Make sense as that class has no definition of _s2l. Interesting I needed to run a modified set [1] of Selenium2Library tests to see it. More interesting only three of tests failed and all of these were recent changes for the WebElements addition. Mmmmm... [Running commentary as I debug tests...]

Ok. Modified unit tests [2] this time but still interesting found only one failing test. Seems like we have very little checks on using the shortcut locator for xpath.

[1] Simply modified test\acceptance\resource.robot to include the AngularJS Library

*** Setting ***
Library           Selenium2Library    run_on_failure=Nothing    implicit_wait=0
Library           AngularJSLibrary
Library           Collections
Library           OperatingSystem

*** Variable ***
#...

[2] Modified tests\unit\locators\test_elementfinder.py

import unittest
import os
#from Selenium2Library.locators import ElementFinder
from AngularJSLibrary import ngElementFinder as ElementFinder
from mockito import *
from robot.utils.asserts import assert_raises_with_msg

# ...

Failure to find root selector hould have specific error message

The following robot script

*** Settings ***
Documentation     Test use of AngularJSLibrary.
Library           SeleniumLibrary
Library           AngularJSLibrary

*** Variables ***
${BROWSER}        Chrome
${URL}            https://clarity.design/
${GETSTARTED}     //*[@id="body"]/app-root/clr-main-container/home/main/section[1]/div[1]/div/a[1]

*** Keywords ***
Visit Angular Site
    Open Browser    ${URL}    ${BROWSER}

Click Get Started
    Click Element    ${GETSTARTED}
    Sleep    5 seconds

*** Test Cases ***
Visit Angular Site
    Visit Angular Site

Click Get Started
    Click Get Started

results in the following error

WebDriverException: Message: unknown error: Could not find testability for element.

The issue, as pointed out by Hélio Guilherme, is that the root selector is not the library default, [ng-app], but instead the site clarity.design uses [ng-version]. Thus the issue in the script above was solved by specifying the root on the library import, as in

...
Library           AngularJSLibrary    root_selector=[ng-version]
...

The error message given is not at all helpful when it could be. The acceptance criteria is when the root locator is not found give a meaningful error.

Robotframework-3.0.2-angularjs_Validation issue

Automating an application which is developed on angular js, and unable to locate elements which are having angular js calls - NG attributes.
Installed robotframework-angularjs via pip successfully, but after adding angularjs library into eclipse(RED), some validating error pop-up is occurred.
Below is the error message.
Validating has encountered a problem.
An internal error occurred while "validating" .
\AngularJSLibrary\0273c5.lipspec(The system cannot find the file specified)

Config details:
Robotframework - 3.0.2
robotframework_angularjs_error

robotframework-angularjs - 0.0.8
robotframework-selenium2library - 3.0.0
robotframework-seleniumlibrary - 3.1.1
robotframework-extendedselenium2library - 0.9.1

Kindly help on this issue. Please find the attached error
robot_angularjs_error.docx
screenshot.

Thanks in Advance!

Improve boolean handling

In library there is this code:

   def set_ignore_implicit_angular_wait(self, ignore):
        if not is_boolean(ignore):
            raise TypeError("Ignore must be

But it might be better to use Robot Framework or SeleniumLibrary is_truthy method to improve boolean handling. SeleniumLibrary method is in here: https://github.com/robotframework/SeleniumLibrary/blob/master/src/SeleniumLibrary/utils/types.py
And it has been there since 3.0 release.

SeleniumLibrary boolean handling is explained in here: http://robotframework.org/SeleniumLibrary/SeleniumLibrary.html#Boolean%20arguments

I can provide you a pull request to fix the problem. Should I copy paste the implementation or can I use method from the SeleniumLibrary? If I can, it will raise minimum required SeleniumLibrary to 3.0.

Python version support

Apologies if this is not the right forum for this question.

I am using the following:

  • RED editor (v 0.9.5) in Eclipse 2020-12 and Python 3.9.1
  • Robot Framework (v 3.2.2)
  • SeleniumLibrary (v 5.0.0)

I am facing issues with the libraries of AngularJSLibrary showing as (non-accessible) whenever used under the 'Referenced Libraries' section of the red.xml file.

Also, except for a few, every other SeleniumLibrary command used causes a Javascript error as follows: "Cannot read property 'get' of undefined".
As soon as I removed the AngularJSLibrary and the associated referenced libraries, the same commands such as "Click Element" or "Wait for Element" started working fine.

Please refer this StackOverflow answer : https://stackoverflow.com/a/49183187/2893031

Could this be an issue of Python 3.9.1 not supporting AngularJSLibrary?

I hope someone can answer this because I feel it is a very useful library. I have a huge Angular-based application to test and using Wait commands is a big and messy overhead on the test code. This could solve a lot of issues.

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.