Re: [selenium-users] Digest for selenium-users@googlegroups.com - 25 Messages in 20 Topics

208 views
Skip to first unread message

sathya sathya

unread,
May 14, 2011, 9:28:36 AM5/14/11
to seleniu...@googlegroups.com
HI  I am new to IDE. My IDE tool stuck up(i am unable to run test case)(play current test case option unable to use).
Any tips please

On 14 May 2011 00:21, <selenium-us...@googlegroups.com> wrote:

Group: http://groups.google.com/group/selenium-users/topics

    Raihan <raiha...@gmail.com> May 13 03:36PM -0700 ^
     
    Hi
     
    I wan to save all the detected elements of a web page in a file . i
    was trying the following example but getting following error.
     
    Caused by: java.io.NotSerializableException:
    org.openqa.selenium.firefox.FirefoxWebElement
    at java.io.ObjectOutputStream.writeObject0(Unknown Source)
    at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)
    at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
    at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
    at java.io.ObjectOutputStream.writeObject0(Unknown Source)
    at java.io.ObjectOutputStream.writeObject(Unknown Source)
     
    any one any idea how to solve it..
     
     
     
    TheCode.
    =======================
    public class Selenium1Example {
     
     
     
    public static void main(String[] args) {
    System.out.println("Initiation Starts");
    WebDriver driver = new FirefoxDriver();
    String baseUrl = "http://www.ltu.se";
    driver.get("http://www.ltu.se");
    Selenium selenium = new WebDriverBackedSelenium(driver, baseUrl);
    selenium.open("http://www.ltu.se");
    selenium.waitForPageToLoad("90000");
    // Get the underlying WebDriver implementation back. This will refer
    to the
    // same WebDriver instance as the "driver" variable above.
     
    String s ="C:\\object.txt";
    FileOutputStream fos = null;
    ObjectOutputStream outObject = null;
    try
    {
    fos = new FileOutputStream(s);
    outObject = new ObjectOutputStream(fos);
    //out.writeObject(time);
    //out.close();
    }
    catch(IOException ex)
    {
    ex.printStackTrace();
    }
    elementSerialized es1;
    List<WebElement> allOptions = driver.findElements(By.tagName("a"));
    for (WebElement option : allOptions)
    {
     
    es1 =new elementSerialized(option);
     
    try
    {
    outObject.writeObject(es1);
    }
    catch(Exception e)
    {
    e.printStackTrace();
    }
    break;
    }
    try
    {
    outObject.close();
    }
    catch(Exception e)
    {
    e.printStackTrace();
    }
    //Finally, close the browser. Call stop on the
    WebDriverBackedSelenium instance
    //instead of calling driver.quit(). Otherwise, the JVM will
    continue running after
    //the browser has been closed.
    //selenium.stop();
     
    WebElement e2=null;
    elementSerialized es2=null;
    FileInputStream fis = null;
    ObjectInputStream in = null;
    try
    {
    fis = new FileInputStream(s);
    in = new ObjectInputStream(fis);
    es2 = (elementSerialized)in.readObject();
    e2=es2.getWebElement();
    in.close();
    }
    catch(IOException ex)
    {
    ex.printStackTrace();
    }
    catch(ClassNotFoundException ex)
    {
    ex.printStackTrace();
    }
     
     
     
     
    }
    }
     
     
    public class elementSerialized implements Serializable
    {
    private WebElement element;
    public elementSerialized(WebElement e1)
    {
    element=e1;
    }
    public void setElement(WebElement e1)
    {
    element=e1;
    }
     
    public WebElement getWebElement()
    {
    return element;
    }
    }

     

    Lutfi Dughman <lut...@gmail.com> May 13 07:14PM -0400 ^
     
    in order for an object to be serilizable, it has to extend Serializable
    interface, also every object that is part of the webelement has to be
    serializable too (only exception is primitives ints/longs/arrays),
     
    I took a fast look at the type hierarchy for WebElement and it doesnt
    implement Serializable.
     

     

    cchris <quas...@gmail.com> May 12 07:25AM -0700 ^
     
    Hi,
    I can run the following command successfully in Selenium IDE 1.0.10 as
    part of a test script:
    <tr>
    <td>storeEval</td>

    <td>this.findEffectiveStyleProperty(this.browserbot.findElement(&quot;//
    form[@id='rechercheProjet']/p[1]&quot;),&quot;backgroundColor&quot;);</
    td>
    <td>varan</td>
    </tr>
     
    I used to be integrating this sort of UI test using Selenium RC1.0.3,
    and that worked too.
    So I switched to Selenium RC 2 and installed the WebDriver plugin for
    Firefox. This way I can export my test to JUnit4. The above command
    translates to
     
    String varan =
    selenium.getEval("this.findEffectiveStyleProperty(this.browsrbot.findElement(\"//
    form[@id='rechercheProjet']/p[1]\"),\"backgroundColor\");");
     
    On running the test, an error occurs tracing back as:
     
    org.openqa.selenium.WebDriverException: TypeError:
    this.window.document.findElement is not a function
    System info: os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1',
    java.version: '1.6.0_20'
    Driver info: driver.version: remote
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
    Method)
    at
    sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:
    39)
    at
    sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:
    27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at
    org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:
    94)
    at
    org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:
    327)
    at
    org.openqa.selenium.firefox.FirefoxDriver.execute(FirefoxDriver.java:
    191)
    at
    org.openqa.selenium.remote.RemoteWebDriver.executeScript(RemoteWebDriver.java:
    272)
    at
    org.openqa.selenium.internal.seleniumemulation.GetEval.handleSeleneseCommand(GetEval.java:
    57)
    at
    org.openqa.selenium.internal.seleniumemulation.GetEval.handleSeleneseCommand(GetEval.java:
    25)
    at
    org.openqa.selenium.internal.seleniumemulation.SeleneseCommand.apply(SeleneseCommand.java:
    30)
    at org.openqa.selenium.WebDriverCommandProcessor
    $1.call(WebDriverCommandProcessor.java:271)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor
    $Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor
    $Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:619)
     
    If I replace the failing statement with the following, admittedly
    cleaner Java code:
     
    WebElement e = driver.findElement(By.xpath("//
    form[@id='rechercheProjet']/p[1]"));
    String varan = e.getAttribute("bgColor");
     
    the test succeeds.
     
    However, because of the guidelines in my organisation, it is desired
    not to need rewriting the Javascript. How would I proceed to keep the
    exported test as unadulterated as possible?
     
    Using selenium v2.0a4 from
    <repository>
    <id>selenium-repository</id>
    <url>http://selenium.googlecode.com/svn/repository/</url>
    </repository>
    as Maven dependency, as suggested in other threads. With no difference
    from v2.0b3, which I had been using earlier. I have double checked
    pom.xml without finding a reference to v2.0b3, from which I infer that
    it's 2.0a4 that still fails.
     
    Sorry for the long post, but I couldn't figure out how to attach and
    factor out the stack trace and stuff.
     
    Any help appreciated.
    TIA
    CChris

     

    Lutfi Dughman <lut...@gmail.com> May 13 07:11PM -0400 ^
     
    give this a try
     
     
    selenium.browserbot.findElement(....)
     

     

    sam6 <sameer...@gmail.com> May 11 09:27PM -0700 ^
     
    Hi,
    I have a page which has form id generated as below:
    <form id="fa6b5309-26bb-41d7-8262-360cd1cfa224"
    onSubmit="returnfalse;" action="app" method="POST" type="form"
    name="page">
     
    I need to retrieve the id fa6b5309-26bb-41d7-8262-360cd1cfa224 which
    is a dynamic one using some regex using selenium.
     
    can you please help me out in doing the same.
     
    thanks
    Sam

     

    Long Phuong <lon...@hotmail.com> May 13 11:08PM ^
     
    try: getAttribute //form[@name='page']@id

     

    asap91 <luckni...@gmail.com> May 13 02:58PM -0700 ^
     
    My batch file:
    java -jar "c:\server\selenium-server-standalone-2.0b3.jar" -htmlSuite
    "*firefox" " https://somesite.com" "c:\SUITE_test1.html" "c:\Results
    \results.html"
     
    I'd like to run several suites back to back so that I have one big
    results.html file that has all the suites run info instead of one
    result file for each suite. Is there a way to do this?
     
    I tried:
    java -jar "c:\server\selenium-server-standalone-2.0b3.jar" -htmlSuite
    "*firefox" " https://somesite.com" "c:\SUITE_test1.html", "c:
    \SUITE_test2.html", "c:\SUITE_test3.html" "c:\Results\results.html"
     
    Thanks

     

    Toresan <fabricio...@gmail.com> May 13 10:52AM -0700 ^
     
    Hi,
     
    We here at our company are still using the Selenium RC server and when
    we started running the tests in IE9 the mouse events weren't working.
     
    I found that the "selenium-browserbot.js" in the method
    BrowserBot.prototype.triggerMouseEvent is using fireEvent for all IE
    versions, but IE9 now uses the createEvent/dispatchEvent methods.
    Has anyone run into these problems?
    The solution seems to be checking whether the window has the
    createEvent and then use it. And cannot be the HTA window, because
    that HTML aparently is in quirks mode and doesn't have this method, it
    only works if you call it from the element window.
     
    Regards,
     
    Fabricio Toresan

     

    Joseph Mecham <mecham...@gmail.com> May 13 09:52AM -0700 ^
     
    I apologize in advance for being such a noob.
     
    I'm writing/running a good sized list of test cases to verify separate
    elements/pages for my company website(s).
    These elements/pages exist or don't exist depending on the level of
    service determined by the username you log in with.
    Therefore, I want to be prompted for username and password on the
    first test case, but then have that be stored and recalled every time
    for all other test cases within the test suite.
    I even thought about creating an extremely simple page to prompt for
    the username and password so I could leave all my test cases the same,
    all using some recall function to get a variable username and password
    (defined with the simple prompt page).
     
    Here is the simple html code for the username/password prompt page:
    <html>
    <head>
    <body>
    <form>
    Username : <input type="text" name="username"><br>
    Password : <input type="text" name="password">
    </form>
    </body>
    </html>
     
    So... to summarize... I need help storing and recalling variables for
    a username and password that are prompted for on the initial test,
    then reused in the rest of the test cases within the test suite.
     
    Thanks in advance for your help,
     
    - Joseph

     

    Joseph Mecham <mecham...@gmail.com> May 13 02:43PM -0600 ^
     
    Any thoughts?
     
     
    --
    - Joseph Mecham

     

    Automated Test Spider <automated....@gmail.com> May 13 03:04PM -0700 ^
     
    I use the Selenium RC python client 2.0b3 with the selenium server
    2.0b3. I am testing a typical log in page, that has typical "Remember
    me" functionality. The web application will try to set a persistent
    cookie, that has a Max-Age of 4 weeks (set in seconds). If the cookie
    is set, then when the user opens the browser, navigates to the web
    application, the cookie is sent, and the user is automatically logged
    in.
    (Typical login/remember me/persistent cookie web application behavior)
     
    A test case for Remember me, would have the test case steps:
    1) Open the browser
    2) Navigate to the web application
    3) Click login
    4) Enter your login name and password, then click submit
    5) Now that you are logged in, quit the browser application so that
    all browser windows are closed
    6) Start the browser
    7) Navigate to the web application
    Expected Results: You are automatically logged in
     
    In Selenium, the typical situation is to initialize a new profile copy
    into a temporary directory, either using a built-in template, or one
    provided by the user. For most tests, this is very wise. However, for
    some test cases, I think there is the desire to be able to close the
    browser, then start the browser, using the actual same profile (not a
    new copy from the template) as before.
     
    I have read the documentation, blogs on the internet, and this group
    fairly carefully.
    I have seen people write their Selenium RC client code in a way so it
    continues to use the same session, in order to avoid the time cost of
    initializing a new copy of the profile template, but the browser is
    never closed.
     
    I have also seen workarounds where you write code to capture the
    cookie through either 'get_cookie' or 'get_cookie_by_name', then after
    closing and restarting the browser, you pull a fast-one by using
    'create_cookie' to write the cookie out again....but here is where
    that will get you into trouble....
     
    On the web application, I mentioned the cookie was using the Max-Age
    attribute. As it turns out, Internet Explorer (up to and including
    IE8, not sure about IE9) does not support the cookie Max-Age
    attribute. You must use the expires cookie attribute. While IE
    ignores the Max-Age attribute, causing the cookie not to persist, it
    does appear to honor the cookie for the session. :(
     
    What this means is, if you do the, "I'll save the cookie, and set it
    myself, after I restart the browser" hack, on Internet Explorer, you
    will have a test case that appears to pass, when in fact, a proper
    automated simulation of the test case, should fail, just like it would
    if you did it manually.
     
    I have attempted to work around Selenium profile initialization. As
    far as I can tell, there is no RC programmatic way to reuse the same
    initialized profile. Once you do a close(), on your last browser
    window, shutting down the browser application, you don't really have
    much choice, but to do stop(), then start(), which will initialize a
    new copy of the profile template, thereby losing any cookies that were
    set. If I'm wrong about there not being a RC programmatic way, please
    let me know. However, I am not interested in any wrapper hacks which
    involve copying the initialized profile on the file system, and
    restarting the selenium server with --firefoxProfileTemplate.
     
    I have also attempted to thwart profile initialization by using the
    *custom browser type, along with specifying the path to firefox or ie.
    I configure the default firefox profile with all the appropriate prefs
    (I know my way around prefs.js, and I know what prefs are set in the
    embedded selenium firefox profile), and configure the proxy settings
    in firefox. Many selenium commands, like "waitForPageToLoad" respond
    with:
    Exception: Permission denied for <http://mydomain.com> to get property
    Window.document
    Perhaps there is an additional firefox configuration that I have
    missed that would allow me to circumvent this permission check. If
    someone could shed light how to do that, please let me know.
     
    Is there a way to automate the test case above, in Selenium RC, which
    would properly simulate manual user behavior, such that, if the
    browser failed to persist the cookie (as it would in the case of IE),
    the test case would fail?
     
    thank you,
    Automated Test Spider

     

    Jfo <jfou...@gmail.com> May 13 12:05PM -0700 ^
     
    I am trying to select dates on an ajax pop calendar with selenium. I
    cannot find any information regarding this so I am having a bit issue
    getting it to work.
     
    I can get the calendar to popup but select the days is where I am
    stuck.
     
    Any help is greatly appreciated!
    Jfo

     

    pjh <pauljh...@gmail.com> May 12 06:24AM -0700 ^
     
    Hi all,
     
    Does anybody know how to set a Firefox profile from inside Eclipse via
    the Remote Control Configuration method.
     
    I need to create a new configuration object and then set profile in
    the .setfirefoxprofiletemplate()
     
    Thanks

     

    Nathan Lane <natham...@gmail.com> May 11 08:54AM -0600 ^
     
    Technically, according to the w3c specifications for HTML text is not
    focusable - only links and form elements (text fields, buttons,
    radiobuttons, checkboxes, and select lists). So what you are trying to do
    may not be possible simply because the browser (all browsers) will not
    support it.
     
    Nathan
     
     
    --
    Nathan Lane
    Blog, http://blog.nathandelane.com

     

    Paul Christopher <pauljchr...@gmail.com> May 12 11:40AM -0700 ^
     
    I see that this is still an outstanding issue with Selenium. Our
    company is evaluating automated testing framworks and while Selenium
    seems to be a really good fit. Without support for NTML
    authentication it is pretty usless to our organization. Anybody know
    if this enhancement will be released anytime soon?

     

    Nathan Lane <natham...@gmail.com> May 11 08:37AM -0600 ^
     
    The problem appears to be that events don't bubble up from the span inside
    the link in this case. Basically this means that if you click on the span,
    which your script does, then nothing happens because the link doesn't ever
    receive the onclick event in order to process it. So instead of clicking on
    the span with id=gsft_logout you need to click on its parent, the link.
     
    Nathan
     
     
    --
    Nathan Lane
    Blog, http://blog.nathandelane.com

     

    bhaswanth <bhasw...@gmail.com> May 12 02:44AM -0700 ^
     
    hi ,
     
    As am new to selenium, am running a script through selenium rc in
    firefox browser, the action is it should download a file and save it
    in a specific location. The download pop up is displayed but selenium
    is not taking any action with the pop up....please help me out ASAP..
     
    Thanks&Regards,
    Bhaswanth

     

    Barrett <gppa...@gmail.com> May 11 10:11AM -0700 ^
     
    I am trying to type some text in a field via Selenium IDE but the test
    fails with 'error Element <eleID> not found'. I am not sure that this
    is timing-related since adding a pause still produces the error, even
    though the field is visibly on the web page.
     
    What is really interesting is that if I create a test suite where test
    case #1 runs everything up to, but not including the 'type text' step,
    then test #2 in the suite runs the text entry as it first step, then
    it all works great. Any ideas?

     

    spsudh <sps...@gmail.com> May 12 09:55PM -0700 ^
     
    What if you dont need to script or write a code while using Selenium?

     

    Freddy <fred...@hotmail.com> May 12 11:18AM -0700 ^
     
    Does anyone know when the next version of Selenium IDE is released?

     

    Nathan Lane <natham...@gmail.com> May 11 09:23AM -0600 ^
     
    Text these days may come in a variety of forms on a web page, some of which
    will not appear in the source HTML, like canvas text, text on an image, or
    text in a flash object. These kinds of text will probably not be targettable
    by selenium, because they are rendered by means that are not part of the
    HTML. I don't know if this is completely true, but generally speaking I
    think if you can't find it in the HTML source code, or at least use a tool
    like Firebug to locate the element on the web page, then you probably can't
    use Selenium to test for it.
     
     
    --
    Nathan Lane
    Blog, http://blog.nathandelane.com

     

    poobathy r <poob...@gmail.com> May 12 02:33PM +0530 ^
     
    Is the id not displayed for the frame
    use the Xpath to locate the class id of the frame with Text
     
    --Poobathy
     

     

    Sivakanth Potluri <sipo...@gmail.com> May 13 12:28AM +0530 ^
     
    Hi,
     
    When I ran below script firebox browser is not getting opened
     
     
     
     
    import org.openqa.selenium.By;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.WebElement;
    import org.openqa.selenium.firefox.FirefoxDriver;
     
    public class nokia {
     
    public static void main(String[] args) {
    WebDriver driver = new FirefoxDriver();
    driver.get("http://www.google.com");
     
    }
     
    }
     
     
    BELOW ERROR IS OBSERVED:
    ---------------------------------------------
     
    Exception in thread "main" java.lang.NoClassDefFoundError:
    com/google/common/base/Function
    at nokia.main(nokia.java:11)
    Caused by: java.lang.ClassNotFoundException: com.google.common.base.Function
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 1 more
     
     
    please help...
     
     
    Thanks in advance
    Siva

     

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.

Reply all
Reply to author
Forward
0 new messages