Skip to main content

XPath-Selenium

[[Selenium]]

XPath Selenium

case insensitive

private By BY_checkbox(string rowValue) => By.XPath($" //*[translate(., 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')='{rowValue}']//ancestor:: tr//div[contains(@class,'ck-checkbox')]//div");

//div[@class='visible menu transition']//span[text()='Inactive']

//span[contains(.,'Status')]/../..//descendant::div[@class='ui selection dropdown']

get parent parent div and following input

//span[contains(.,'Domains')]/../..//descendant::input

siblings

//span[@class='label' and text()='First Name']/../following-sibling::div/div/input

//div[contains(@class,'cd tree')]//span[text()='Newsletters']/../preceding-sibling::span

var callerWindowHandle = WebDriver.CurrentWindowHandle;

var elems = _appMenuParentElem.FindElements(BY_appMenu_link);

var elem = elems.Single(x => x.Text.Trim() == app.GetDescription());

var calleeWindowHandle = new PopupWindowFinder(WebDriver).Click(elem);

//span[contains(@class, 'myclass') and text() = 'qwerty']