GetFrameAsync

Parent Previous Next

GetFrameAsync

Описание: метод возвращает элемент в виде объект класс которого FRAMEElement

Синтаксис: GetFrameAsync(int index)

Возвращаемое значение: объект (FRAMEElement)



Пример:

Tester tester = new Tester(browserForm);

await tester.TestBeginAsync();

await tester.GoToUrlAsync("https://somovstudio.github.io/test2.html", 5);


FRAMEElement frame = await tester.GetFrameAsync(0);

tester.ConsoleMsg("Index: " + frame.Index);

tester.ConsoleMsg("Name: " + frame.Name);


string name = await frame.GetAttributeFromElementAsync(Tester.BY_XPATH, "//input[@id='login']", "name");


List<string> values = await frame.GetAttributeFromElementsAsync(Tester.BY_XPATH, "//input", "name");

if (values != null)

{

       foreach (string attr in values)

               tester.ConsoleMsg(attr);

}


await frame.SetAttributeInElementAsync(Tester.BY_XPATH, "//input[@id='buttonLogin']", "name", "NameButtonLogin");


await frame.SetAttributeInElementsAsync(Tester.BY_XPATH, "//input", "name", "test");


await frame.SetValueInElementAsync(Tester.BY_XPATH, "//input[@id='login']", "Тестировщик");

string value = await frame.GetValueFromElementAsync(Tester.BY_XPATH, "//input[@id='login']");


await frame.ClickElementAsync(Tester.BY_XPATH, "//*[@id='buttonLogin']");


bool result = await frame.IsClickableElementAsync(Tester.BY_XPATH, "//*[@id='buttonLogin']");


await frame.ScrollToElementAsync(Tester.BY_XPATH, "//*[@id='buttonLogin']", true);


int result = await frame.GetCountElementsAsync(Tester.BY_XPATH, "//input");


string html = await frame.GetHtmlFromElementAsync(Tester.BY_XPATH, "//*[@id='buttonLogin']");


await frame.SetHtmlInElementAsync(Tester.BY_XPATH, "//*[@id='auth']/h2", "<h2>Тестовый заголовок</h2>");


await frame.WaitNotVisibleElementAsync(Tester.BY_XPATH, "//*[@id='result']", 5);

await frame.ClickElementAsync(Tester.BY_XPATH, "//*[@id='buttonLogin']");

await frame.WaitVisibleElementAsync(Tester.BY_XPATH, "//*[@id='result']", 5);


bool result = await frame.FindElementAsync(Tester.BY_XPATH, "//*[@id='result']", 5);


bool result = await frame.FindVisibleElementAsync(Tester.BY_XPATH, "//*[@id='result']", 5);


string title = await frame.GetTitleAsync();


string url = await frame.GetUrlAsync();


await frame.SetTextInElementAsync(Tester.BY_XPATH, "//*[@id='auth']/h2", "Это тест");

string text = await frame.GetTextFromElementAsync(Tester.BY_XPATH, "//*[@id='auth']/h2");


await frame.SelectOptionAsync(Tester.BY_XPATH, "//*[@id='MySelect']", FRAMEElement.BY_INDEX, "2");

await frame.SelectOptionAsync(Tester.BY_XPATH, "//*[@id='MySelect']", FRAMEElement.BY_VALUE, "Mobile");

await frame.SelectOptionAsync(Tester.BY_XPATH, "//*[@id='MySelect']", FRAMEElement.BY_TEXT, "Other");


string index = await frame.GetOptionAsync(Tester.BY_XPATH, "//*[@id='MySelect']", FRAMEElement.BY_INDEX);

string value = await frame.GetOptionAsync(Tester.BY_XPATH, "//*[@id='MySelect']", FRAMEElement.BY_VALUE);

string text = await frame.GetOptionAsync(Tester.BY_XPATH, "//*[@id='MySelect']", FRAMEElement.BY_TEXT);

Created with the Personal Edition of HelpNDoc: Free help authoring tool