WebElementObject

WebElementObject[]

represents an element of an open webpage operated on by WebExecute.

Details

  • WebExecute supports the following commands related to WebElementObject:
  • "LocateElements"elemgive the list of elements on a webpage matching elem
    "ClickElement"elemclick an element on a webpage (e.g. a hyperlink)
    "HoverElement"elemhover over an element on a webpage
    "TypeElement"{elem,"text"}type text into an element on a webpage (e.g. an input field)
    "SubmitElement"elemsubmit a form using the specified element (e.g. a button)
    "ElementSelected"elemwhether an element is selected
    "ElementEnabled"elemwhether an element is enabled
    "ElementTag"elemthe HTML tag for the element
    "ElementText"elemthe text, if any, associated with an element
    "HideElement"elemmake an element invisible
    "ShowElement"elemmake an element visible

Examples

Basic Examples  (2)

Start a web session:

In[1]:=
Click for copyable input
Out[1]=

Open a webpage:

In[2]:=
Click for copyable input
Out[2]=

Use WebExecute to locate a WebElementObject link on a page:

In[3]:=
Click for copyable input
Out[3]=

Use WebExecute to find the text of a WebElementObject:

In[4]:=
Click for copyable input
Out[4]=

Click the WebElementObject link:

In[5]:=
Click for copyable input

Close the session:

In[6]:=
Click for copyable input

Start a web session:

In[1]:=
Click for copyable input
Out[1]=

Open a webpage:

In[2]:=
Click for copyable input
Out[2]=

Get all the elements for the <p> (paragraph) tag:

In[3]:=
Click for copyable input

Hide all the paragraphs of text on the page:

In[4]:=
Click for copyable input

All text paragraphs are now hidden:

In[5]:=
Click for copyable input
Out[5]=

Show the text paragraphs again:

In[6]:=
Click for copyable input

The text has reappeared on the page:

In[7]:=
Click for copyable input
Out[7]=
In[8]:=
Click for copyable input
Introduced in 2019
(12.0)