Information about web elements
There are a number of details you can query about a specific element.
Is Displayed
This method is used to check if the connected Element is
displayed on a webpage. Returns a Boolean value,
True if the connected element is displayed in the current
browsing context else returns false.
This functionality is mentioned in, but not defined by the w3c specification due to the impossibility of covering all potential conditions. As such, Selenium cannot expect drivers to implement this functionality directly, and now relies on executing a large JavaScript function directly. This function makes many approximations about an element’s nature and relationship in the tree to return a value.
SELENIUM_CI_TOKEN not set
If you want to render content fetched from the GitHub API, please create a
personal access token
and set it as an environment variable named SELENIUM_CI_TOKEN. More information about token scopes can
be seen at
available scopes GitHub docs
# Navigate to the url
driver.get("https://www.selenium.dev/selenium/web/inputs.html")
# Get boolean value for is element display
is_email_visible = driver.find_element(By.NAME, "email_input").is_displayed()
<div class="alert alert-primary bg-transparent col-10 ps-lg-5 m-4" role="alert">
<h4 class="alert-heading"><code>SELENIUM_CI_TOKEN</code> not set</h4>
<p>
If you want to render content fetched from the GitHub API, please create a
<a
href="https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token"
target="_blank"
>
personal access token
</a> and set it as an environment variable named <code>SELENIUM_CI_TOKEN</code>. More information about token scopes can
be seen at
<a
href="https://docs.github.com/en/developers/apps/building-oauth-apps/scopes-for-oauth-apps#available-scopes"
target="_blank"
>
available scopes GitHub docs
</a>
</p>
</div>SELENIUM_CI_TOKEN not set
If you want to render content fetched from the GitHub API, please create a
personal access token
and set it as an environment variable named SELENIUM_CI_TOKEN. More information about token scopes can
be seen at
available scopes GitHub docs
SELENIUM_CI_TOKEN not set
If you want to render content fetched from the GitHub API, please create a
personal access token
and set it as an environment variable named SELENIUM_CI_TOKEN. More information about token scopes can
be seen at
available scopes GitHub docs
//navigates to url
driver.get("https://www.selenium.dev/selenium/web/inputs.html")
//returns true if element is displayed else returns false
val flag = driver.findElement(By.name("email_input")).isDisplayed()Is Enabled
This method is used to check if the connected Element is enabled or disabled on a webpage. Returns a boolean value, True if the connected element is enabled in the current browsing context else returns false.
SELENIUM_CI_TOKEN not set
If you want to render content fetched from the GitHub API, please create a
personal access token
and set it as an environment variable named SELENIUM_CI_TOKEN. More information about token scopes can
be seen at
available scopes GitHub docs
# Navigate to url
driver.get("https://www.selenium.dev/selenium/web/inputs.html")
# Returns true if element is enabled else returns false
value = driver.find_element(By.NAME, 'button_input').is_enabled()
<div class="alert alert-primary bg-transparent col-10 ps-lg-5 m-4" role="alert">
<h4 class="alert-heading"><code>SELENIUM_CI_TOKEN</code> not set</h4>
<p>
If you want to render content fetched from the GitHub API, please create a
<a
href="https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token"
target="_blank"
>
personal access token
</a> and set it as an environment variable named <code>SELENIUM_CI_TOKEN</code>. More information about token scopes can
be seen at
<a
href="https://docs.github.com/en/developers/apps/building-oauth-apps/scopes-for-oauth-apps#available-scopes"
target="_blank"
>
available scopes GitHub docs
</a>
</p>
</div>SELENIUM_CI_TOKEN not set
If you want to render content fetched from the GitHub API, please create a
personal access token
and set it as an environment variable named SELENIUM_CI_TOKEN. More information about token scopes can
be seen at
available scopes GitHub docs
SELENIUM_CI_TOKEN not set
If you want to render content fetched from the GitHub API, please create a
personal access token
and set it as an environment variable named SELENIUM_CI_TOKEN. More information about token scopes can
be seen at
available scopes GitHub docs
//navigates to url
driver.get("https://www.selenium.dev/selenium/web/inputs.html")
//returns true if element is enabled else returns false
val attr = driver.findElement(By.name("button_input")).isEnabled()
Elemento está selecionado
Este método determina se o elemento referenciado é Selected ou não. Este método é amplamente utilizado em caixas de seleção, botões de opção, elementos de entrada e elementos de opção.
Retorna um valor booleano, true se o elemento referenciado for selected no contexto de navegação atual, caso contrário, retorna false.
SELENIUM_CI_TOKEN not set
If you want to render content fetched from the GitHub API, please create a
personal access token
and set it as an environment variable named SELENIUM_CI_TOKEN. More information about token scopes can
be seen at
available scopes GitHub docs
# Navigate to url
driver.get("https://www.selenium.dev/selenium/web/inputs.html")
# Returns true if element is checked else returns false
value = driver.find_element(By.NAME, "checkbox_input").is_selected()
<div class="alert alert-primary bg-transparent col-10 ps-lg-5 m-4" role="alert">
<h4 class="alert-heading"><code>SELENIUM_CI_TOKEN</code> not set</h4>
<p>
If you want to render content fetched from the GitHub API, please create a
<a
href="https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token"
target="_blank"
>
personal access token
</a> and set it as an environment variable named <code>SELENIUM_CI_TOKEN</code>. More information about token scopes can
be seen at
<a
href="https://docs.github.com/en/developers/apps/building-oauth-apps/scopes-for-oauth-apps#available-scopes"
target="_blank"
>
available scopes GitHub docs
</a>
</p>
</div>SELENIUM_CI_TOKEN not set
If you want to render content fetched from the GitHub API, please create a
personal access token
and set it as an environment variable named SELENIUM_CI_TOKEN. More information about token scopes can
be seen at
available scopes GitHub docs
SELENIUM_CI_TOKEN not set
If you want to render content fetched from the GitHub API, please create a
personal access token
and set it as an environment variable named SELENIUM_CI_TOKEN. More information about token scopes can
be seen at
available scopes GitHub docs
//navigates to url
driver.get("https://www.selenium.dev/selenium/web/inputs.html")
//returns true if element is checked else returns false
val attr = driver.findElement(By.name("checkbox_input")).isSelected()
Coletar TagName do elemento
É usado para buscar o TagName do elemento referenciado que tem o foco no contexto de navegação atual.
SELENIUM_CI_TOKEN not set
If you want to render content fetched from the GitHub API, please create a
personal access token
and set it as an environment variable named SELENIUM_CI_TOKEN. More information about token scopes can
be seen at
available scopes GitHub docs
# Navigate to url
driver.get("https://www.selenium.dev/selenium/web/inputs.html")
# Returns TagName of the element
attr = driver.find_element(By.NAME, "email_input").tag_name
<div class="alert alert-primary bg-transparent col-10 ps-lg-5 m-4" role="alert">
<h4 class="alert-heading"><code>SELENIUM_CI_TOKEN</code> not set</h4>
<p>
If you want to render content fetched from the GitHub API, please create a
<a
href="https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token"
target="_blank"
>
personal access token
</a> and set it as an environment variable named <code>SELENIUM_CI_TOKEN</code>. More information about token scopes can
be seen at
<a
href="https://docs.github.com/en/developers/apps/building-oauth-apps/scopes-for-oauth-apps#available-scopes"
target="_blank"
>
available scopes GitHub docs
</a>
</p>
</div>SELENIUM_CI_TOKEN not set
If you want to render content fetched from the GitHub API, please create a
personal access token
and set it as an environment variable named SELENIUM_CI_TOKEN. More information about token scopes can
be seen at
available scopes GitHub docs
SELENIUM_CI_TOKEN not set
If you want to render content fetched from the GitHub API, please create a
personal access token
and set it as an environment variable named SELENIUM_CI_TOKEN. More information about token scopes can
be seen at
available scopes GitHub docs
//navigates to url
driver.get("https://www.selenium.dev/selenium/web/inputs.html")
//returns TagName of the element
val attr = driver.findElement(By.name("email_input")).getTagName()
Coletar retângulo do elemento
É usado para buscar as dimensões e coordenadas do elemento referenciado.
O corpo de dados buscado contém os seguintes detalhes:
- Posição do eixo X a partir do canto superior esquerdo do elemento
- posição do eixo y a partir do canto superior esquerdo do elemento
- Altura do elemento
- Largura do elemento
SELENIUM_CI_TOKEN not set
If you want to render content fetched from the GitHub API, please create a
personal access token
and set it as an environment variable named SELENIUM_CI_TOKEN. More information about token scopes can
be seen at
available scopes GitHub docs
# Navigate to url
driver.get("https://www.selenium.dev/selenium/web/inputs.html")
# Returns height, width, x and y coordinates referenced element
res = driver.find_element(By.NAME, "range_input").rect
<div class="alert alert-primary bg-transparent col-10 ps-lg-5 m-4" role="alert">
<h4 class="alert-heading"><code>SELENIUM_CI_TOKEN</code> not set</h4>
<p>
If you want to render content fetched from the GitHub API, please create a
<a
href="https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token"
target="_blank"
>
personal access token
</a> and set it as an environment variable named <code>SELENIUM_CI_TOKEN</code>. More information about token scopes can
be seen at
<a
href="https://docs.github.com/en/developers/apps/building-oauth-apps/scopes-for-oauth-apps#available-scopes"
target="_blank"
>
available scopes GitHub docs
</a>
</p>
</div>SELENIUM_CI_TOKEN not set
If you want to render content fetched from the GitHub API, please create a
personal access token
and set it as an environment variable named SELENIUM_CI_TOKEN. More information about token scopes can
be seen at
available scopes GitHub docs
SELENIUM_CI_TOKEN not set
If you want to render content fetched from the GitHub API, please create a
personal access token
and set it as an environment variable named SELENIUM_CI_TOKEN. More information about token scopes can
be seen at
available scopes GitHub docs
// Navigate to url
driver.get("https://www.selenium.dev/selenium/web/inputs.html")
// Returns height, width, x and y coordinates referenced element
val res = driver.findElement(By.name("range_input")).rect
// Rectangle class provides getX,getY, getWidth, getHeight methods
println(res.getX())
Coletar valor CSS do elemento
Recupera o valor da propriedade de estilo computado especificada de um elemento no contexto de navegação atual.
SELENIUM_CI_TOKEN not set
If you want to render content fetched from the GitHub API, please create a
personal access token
and set it as an environment variable named SELENIUM_CI_TOKEN. More information about token scopes can
be seen at
available scopes GitHub docs
# Navigate to Url
driver.get('https://www.selenium.dev/selenium/web/colorPage.html')
# Retrieves the computed style property 'color' of linktext
cssValue = driver.find_element(By.ID, "namedColor").value_of_css_property('background-color')
<div class="alert alert-primary bg-transparent col-10 ps-lg-5 m-4" role="alert">
<h4 class="alert-heading"><code>SELENIUM_CI_TOKEN</code> not set</h4>
<p>
If you want to render content fetched from the GitHub API, please create a
<a
href="https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token"
target="_blank"
>
personal access token
</a> and set it as an environment variable named <code>SELENIUM_CI_TOKEN</code>. More information about token scopes can
be seen at
<a
href="https://docs.github.com/en/developers/apps/building-oauth-apps/scopes-for-oauth-apps#available-scopes"
target="_blank"
>
available scopes GitHub docs
</a>
</p>
</div>SELENIUM_CI_TOKEN not set
If you want to render content fetched from the GitHub API, please create a
personal access token
and set it as an environment variable named SELENIUM_CI_TOKEN. More information about token scopes can
be seen at
available scopes GitHub docs
SELENIUM_CI_TOKEN not set
If you want to render content fetched from the GitHub API, please create a
personal access token
and set it as an environment variable named SELENIUM_CI_TOKEN. More information about token scopes can
be seen at
available scopes GitHub docs
// Navigate to Url
driver.get("https://www.selenium.dev/selenium/web/colorPage.html")
// Retrieves the computed style property 'color' of linktext
val cssValue = driver.findElement(By.id("namedColor")).getCssValue("background-color")
Coletar texto do elemento
Recupera o texto renderizado do elemento especificado.
SELENIUM_CI_TOKEN not set
If you want to render content fetched from the GitHub API, please create a
personal access token
and set it as an environment variable named SELENIUM_CI_TOKEN. More information about token scopes can
be seen at
available scopes GitHub docs
# Navigate to url
driver.get("https://www.selenium.dev/selenium/web/linked_image.html")
# Retrieves the text of the element
text = driver.find_element(By.ID, "justanotherlink").text
<div class="alert alert-primary bg-transparent col-10 ps-lg-5 m-4" role="alert">
<h4 class="alert-heading"><code>SELENIUM_CI_TOKEN</code> not set</h4>
<p>
If you want to render content fetched from the GitHub API, please create a
<a
href="https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token"
target="_blank"
>
personal access token
</a> and set it as an environment variable named <code>SELENIUM_CI_TOKEN</code>. More information about token scopes can
be seen at
<a
href="https://docs.github.com/en/developers/apps/building-oauth-apps/scopes-for-oauth-apps#available-scopes"
target="_blank"
>
available scopes GitHub docs
</a>
</p>
</div>SELENIUM_CI_TOKEN not set
If you want to render content fetched from the GitHub API, please create a
personal access token
and set it as an environment variable named SELENIUM_CI_TOKEN. More information about token scopes can
be seen at
available scopes GitHub docs
SELENIUM_CI_TOKEN not set
If you want to render content fetched from the GitHub API, please create a
personal access token
and set it as an environment variable named SELENIUM_CI_TOKEN. More information about token scopes can
be seen at
available scopes GitHub docs
// Navigate to URL
driver.get("https://www.selenium.dev/selenium/web/linked_image.html")
// retrieves the text of the element
val text = driver.findElement(By.id("justanotherlink")).getText()
Fetching Attributes or Properties
Fetches the run time value associated with a DOM attribute. It returns the data associated with the DOM attribute or property of the element.
SELENIUM_CI_TOKEN not set
If you want to render content fetched from the GitHub API, please create a
personal access token
and set it as an environment variable named SELENIUM_CI_TOKEN. More information about token scopes can
be seen at
available scopes GitHub docs
# Navigate to the url
driver.get("https://www.selenium.dev/selenium/web/inputs.html")
# Identify the email text box
email_txt = driver.find_element(By.NAME, "email_input")
# Fetch the value property associated with the textbox
value_info = email_txt.get_attribute("value")
<div class="alert alert-primary bg-transparent col-10 ps-lg-5 m-4" role="alert">
<h4 class="alert-heading"><code>SELENIUM_CI_TOKEN</code> not set</h4>
<p>
If you want to render content fetched from the GitHub API, please create a
<a
href="https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token"
target="_blank"
>
personal access token
</a> and set it as an environment variable named <code>SELENIUM_CI_TOKEN</code>. More information about token scopes can
be seen at
<a
href="https://docs.github.com/en/developers/apps/building-oauth-apps/scopes-for-oauth-apps#available-scopes"
target="_blank"
>
available scopes GitHub docs
</a>
</p>
</div>SELENIUM_CI_TOKEN not set
If you want to render content fetched from the GitHub API, please create a
personal access token
and set it as an environment variable named SELENIUM_CI_TOKEN. More information about token scopes can
be seen at
available scopes GitHub docs
SELENIUM_CI_TOKEN not set
If you want to render content fetched from the GitHub API, please create a
personal access token
and set it as an environment variable named SELENIUM_CI_TOKEN. More information about token scopes can
be seen at
available scopes GitHub docs
// Navigate to URL
driver.get("https://www.selenium.dev/selenium/web/inputs.html")
//fetch the value property associated with the textbox
val attr = driver.findElement(By.name("email_input")).getAttribute("value")




