Skip to content

Commit d32aed3

Browse files
Peyton88Peyton_Fang
authored and
Peyton_Fang
committed
Sample of Get Element CSS Value
1 parent 23d95d3 commit d32aed3

File tree

1 file changed

+38
-6
lines changed

1 file changed

+38
-6
lines changed

docs_source_files/content/webdriver/web_element.en.md

+38-6
Original file line numberDiff line numberDiff line change
@@ -775,25 +775,57 @@ of an element in the current browsing context.
775775

776776
{{< code-tab >}}
777777
{{< code-panel language="java" >}}
778-
// Please provide a pr for the code sample
778+
779+
// Navigate to Url
780+
driver.get('https://www.example.com');
781+
782+
// Retrieves the computed style property 'color' of linktext
783+
String cssValue = driver.findElement(By.linkText("More information...")).getCssValue('color');
784+
779785
{{< / code-panel >}}
780786
{{< code-panel language="python" >}}
781-
// Please provide a pr for the code sample
787+
788+
# Navigate to Url
789+
driver.get('https://www.example.com');
790+
791+
# Retrieves the computed style property 'color' of linktext
792+
cssValue = driver.findElement(By.LINK_TEXT, "More information...").value_of_css_property('color');
793+
782794
{{< / code-panel >}}
783795
{{< code-panel language="csharp" >}}
784-
// Please provide a pr for the code sample
796+
797+
// Navigate to Url
798+
driver.Navigate().GoToUrl('https://www.example.com');
799+
800+
// Retrieves the computed style property 'color' of linktext
801+
String cssValue = driver.FindElement(By.LinkText("More information...")).GetCssValue('color');
802+
785803
{{< / code-panel >}}
786804
{{< code-panel language="ruby" >}}
787-
// Please provide a pr for the code sample
805+
806+
# Navigate to Url
807+
driver.get 'https://www.example.com'
808+
809+
# Retrieves the computed style property 'color' of linktext
810+
cssValue = driver.find_element(:link_text, 'More information...').css_value('color');
811+
788812
{{< / code-panel >}}
789813
{{< code-panel language="javascript" >}}
814+
790815
// Navigate to Url
791816
await driver.get('https://www.example.com');
792-
817+
793818
// Retrieves the computed style property 'color' of linktext
794819
let cssValue = await driver.findElement(By.linkText("More information...")).getCssValue('color');
820+
795821
{{< / code-panel >}}
796822
{{< code-panel language="kotlin" >}}
797-
// Please provide a pr for the code sample
823+
824+
// Navigate to Url
825+
driver.get('https://www.example.com');
826+
827+
// Retrieves the computed style property 'color' of linktext
828+
val cssValue = driver.findElement(By.linkText("More information...")).getCssValue('color');
829+
798830
{{< / code-panel >}}
799831
{{< / code-tab >}}

0 commit comments

Comments
 (0)