MarkusBernhardt / robotframework-selenium2library-java

Java port of the Selenium 2 (WebDriver) Python library for Robot Framework
Apache License 2.0
46 stars 48 forks source link

Getting Error : Selenium2Library' object has no attribute '_current_browser' #99

Closed dipakbachhav closed 6 years ago

dipakbachhav commented 6 years ago

Hi,

i am trying to create custom python library which will help me for further operation using robot framework but currently i am facing below issue. Can someone please help me with the same.

Python file test.py

`import urllib
from robot.libraries.BuiltIn import BuiltIn

def get_webdriver_instance():
    se2lib = BuiltIn().get_library_instance('Selenium2Library')
    return se2lib._current_browser()
`

Robot file


` *** Settings ***
Library                                             Selenium2Library
Library                                             C:\\Users\\Username\\workspace\\webapplication.sample\\src\\test\\robotframework\\common\\lib\\test.py

*** Test Cases ***
RobotTest
    Open Browser                                    https://finance.google.co.uk/finance     gc
    ${webdriver}=     Get webdriver instance
    Log    ${webdriver}
    saveImage        ${webdriver}    //a[@id='aw0']/img    Myimage.png
    # saveImage1       //img[contains(@src, 'logo.png')]    myfile11sdasd1.pn
    Log    ${webdriver}
    # Wait Until Element Is Not Visible    xpath=//div[@id='splash']/div[3]/div
    Sleep     20
    Click Element    xpath=//div[@id='splash']/div[3]/div`

Error


Start / End / Elapsed:  20171020 19:53:14.261 / 20171020 19:53:14.290 / 00:00:00.029
19:53:14.279    FAIL    AttributeError: 'Selenium2Library' object has no attribute '_current_browser'
SSaranya67 commented 4 years ago

how did you resolve this issue?

SSaranya67 commented 4 years ago

@dipakbachhav can you share the solution?