Selenium Webdriver: Page factory initialization using paths relative to other elements?
问题 I'm trying to write a page object in Selenium Webdriver using the page factory @FindBy annotations. The page object is for a sidebar, and the parent WebElement containing all elements the page object needs to interact with is initialized in this way: @FindBy (xpath = "//div[contains(@class,'yui3-accordion-panel-content') and child::div[.='Sidebar']]") WebElement sidebar; I then want the search input relative to this sidebar element. Is there a way to do this referencing sidebar element? I