Community
Participate
Working Groups
Build Identifier: 20110916-0149 static fluent interface: webdriver.findElement(By.id("profil_header").xpath("/h1")).getText() -> By.id("profil_header").xpath("/h1"); see api http://selenium.googlecode.com/svn/trunk/docs/api/java/org/openqa/selenium/By.html Reproducible: Always Steps to Reproduce: 1. import org.openqa.selenium.By; public class Bug{ public static void main(String[] args){ By.id("profil_header").xpath("/h1"); } } 2. see the warning
Can you explain why you think the warning is wrong? By#xpath(String) is a static method, so By.id("profil_header").xpath("/h1") is equivalent to By.xpath("/h1") , unless the execution of By#id(String) changes some global state, which would be quite bad style and is not documented. Moving to JDT Core to close.
Agree with Markus. I intend to close as invalid. By.id("profil_header") returns a new object, from which the static function xpath("/h1") is being invoked. This warning is indeed meant to catch cases such as these.
Agreed, closing as invalid. FWIW, the intended WebDriver usage would be: webdriver.findElement(By.id("profil_header")).findElement(By.xpath("/h1")).getText()