Skip to content
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.

selenium.assignId did not seem to assign an ID when using Firefox 5.0 #2121

Closed
lukeis opened this issue Mar 2, 2016 · 5 comments
Closed

Comments

@lukeis
Copy link
Member

lukeis commented Mar 2, 2016

Originally reported on Google Code with ID 2121

What steps will reproduce the problem?
1. see test code below


What is the expected output? What do you see instead?
after setting the id with selenium.assignId("//form", "form1");
expected selenium.getAttribute("//form@id") to return the value of the id
instead get a selenium exception could not find attribute "//form@id"


Selenium version: 2.1.0 and 2.0.0
OS: Windows 7
Browser: Firefox
Brower version: 5.0

It works on google chrome 12

Minimal test below and attached uses Junit
---------------------------------------------------

package com.eviltester.bugs;

import static org.junit.Assert.assertEquals;

import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.Selenium;

public class InvestigatePossibleAssignIDBug {

    private static Selenium selenium;

    // failed on *firefox  against 5.0
    // failed on *chrome
    // works on *googlechrome 12.0.742.122

    @BeforeClass
    public static void setUpBeforeClass() throws Exception {
        selenium = new DefaultSelenium("localhost", 4444, 
                "*firefox", "http://compendiumdev.co.uk");
        selenium.start();
    }

    @AfterClass
    public static void tearDownAfterClass() throws Exception {
        selenium.close();
        selenium.stop();
    }

    @Before
    public void setUp() throws Exception {
        // this page has a simple form
        // the form does not have an id
        // some of the form elements have ids
        selenium.open("/selenium/basic_ajax.html");
    }


    @Test
    public void ruleOutRestOfTestCodeBySettingIDWithoutUsingAssignID(){
        assertEquals("could not get combo name using id","id",selenium.getAttribute("id=combo1@name"));

        //check that we can access the form attributes
        assertEquals("could not access form method","post", selenium.getAttribute("//form@method"));

        String result = selenium.getEval("window.document.forms[0].setAttribute('id','newformid');");

        assertEquals("could not get form id","newformid",selenium.getAttribute("//form@id"));       

    }

    @Test
    public void assignIDBug(){
        //check that we can get an attribute using an id
        assertEquals("could not get combo name using id","id",selenium.getAttribute("id=combo1@name"));

        //check that we can access the form attributes
        assertEquals("could not access form method","post", selenium.getAttribute("//form@method"));

        // have tried xpath=//form
        // have tried css=form
        selenium.assignId("//form", "form1");

        assertEquals("could not get form id","form1",selenium.getAttribute("//form@id"));       
    }   


}

Reported by alan.j.richardson on 2011-07-25 10:06:29


- _Attachment: [InvestigatePossibleAssignIDBug.java](https://storage.googleapis.com/google-code-attachments/selenium/issue-2121/comment-0/InvestigatePossibleAssignIDBug.java)_
@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Reported by barancev on 2011-10-13 06:39:35

  • Labels added: Component-RC, Browser-Firefox

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

All active development is focused on Selenium 2.0 (the WebDriver APIs).  Updating issue
priority accordingly.

Reported by jmleyba on 2012-01-04 03:06:22

  • Labels added: Priority-Low

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Is still issue still actual? If it is, please provide an executable scenario and a sample
page to reproduce it.

The following scenario works as expected and prints "form1" to the console:

     Selenium selenium = new DefaultSelenium("localhost", 4444, "*firefox", "http://compendiumdev.co.uk/");
     selenium.start();
     selenium.open("/selenium/basic_ajax.html");
     selenium.assignId("//form", "form1");
     System.out.println(selenium.getAttribute("//form@id"));
     selenium.stop();

Reported by barancev on 2013-10-29 21:20:35

  • Status changed: NeedsClarification

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Closing the issue due to inactivity. Also RC is deprecated.

Reported by barancev on 2014-01-09 12:47:04

  • Status changed: Fixed

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Reported by luke.semerau on 2015-09-17 18:13:17

  • Labels added: Restrict-AddIssueComment-Commit

@lukeis lukeis closed this as completed Mar 2, 2016
@SeleniumHQ SeleniumHQ locked and limited conversation to collaborators Mar 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant