Untitled
unknown
plain_text
9 months ago
900 B
9
Indexable
public void ClickProjekt()
{
var by = By.CssSelector("#selection-project-button > a");
IWebElement el = null;
driver.SwitchTo().DefaultContent();
try { el = new WebDriverWait(driver, TimeSpan.FromSeconds(4)).Until(d => d.FindElement(by)); }
catch
{
foreach (var f in driver.FindElements(By.CssSelector("iframe,frame")))
{
driver.SwitchTo().Frame(f);
var list = driver.FindElements(by);
if (list.Count > 0) { el = list[0]; break; }
driver.SwitchTo().ParentFrame();
}
}
if (el == null) throw new NoSuchElementException("Nu găsesc 'Projekt auswählen'.");
((IJavaScriptExecutor)driver).ExecuteScript("arguments[0].scrollIntoView({block:'center',inline:'center'});", el);
((IJavaScriptExecutor)driver).ExecuteScript("arguments[0].click();", el);
driver.SwitchTo().DefaultContent();
}Editor is loading...
Leave a Comment