mirror of
https://github.com/openbullet/openbullet.git
synced 2023-10-21 07:33:42 -05:00
Added ElementAction to select options from select elements
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using OpenQA.Selenium;
|
||||
using OpenQA.Selenium.Support.UI;
|
||||
using RuriLib.Functions.Files;
|
||||
using RuriLib.LS;
|
||||
using System;
|
||||
@@ -55,6 +56,15 @@ namespace RuriLib
|
||||
/// <summary>Submits a form element.</summary>
|
||||
Submit,
|
||||
|
||||
/// <summary>Selects an option from a select element by visible text.</summary>
|
||||
SelectOptionByText,
|
||||
|
||||
/// <summary>Selects an option from a select element by index.</summary>
|
||||
SelectOptionByIndex,
|
||||
|
||||
/// <summary>Selects an option from a select element by value.</summary>
|
||||
SelectOptionByValue,
|
||||
|
||||
/// <summary>Gets the text inside an element.</summary>
|
||||
GetText,
|
||||
|
||||
@@ -260,6 +270,18 @@ namespace RuriLib
|
||||
UpdateSeleniumData(data);
|
||||
break;
|
||||
|
||||
case ElementAction.SelectOptionByText:
|
||||
new SelectElement(element).SelectByText(ReplaceValues(input, data));
|
||||
break;
|
||||
|
||||
case ElementAction.SelectOptionByIndex:
|
||||
new SelectElement(element).SelectByIndex(int.Parse(ReplaceValues(input, data)));
|
||||
break;
|
||||
|
||||
case ElementAction.SelectOptionByValue:
|
||||
new SelectElement(element).SelectByValue(ReplaceValues(input, data));
|
||||
break;
|
||||
|
||||
case ElementAction.GetText:
|
||||
if (recursive) foreach (var elem in elements) outputs.Add(elem.Text);
|
||||
else outputs.Add(element.Text);
|
||||
|
||||
Reference in New Issue
Block a user