Skip to main content

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']