You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.
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
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();
Originally reported on Google Code with ID 2121
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)_
The text was updated successfully, but these errors were encountered: