Skip to content

Sample of Get Element CSS Value #527

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 27, 2020
Merged

Sample of Get Element CSS Value #527

merged 2 commits into from
Sep 27, 2020

Conversation

Peyton88
Copy link
Contributor

@Peyton88 Peyton88 commented Sep 22, 2020

Thanks for contributing to the Selenium site and documentation!
A PR well described will help maintainers to quickly review and merge it

Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, help reviewers by making them as simple and short as possible.

Description

Motivation and Context

Types of changes

  • Change to the site (I am attaching a screenshot showing the before and after)
  • Code example added (and I also added the example to all translated languages)
  • Improved translation
  • Added new translation (and I also added a notice to each document missing translation)

Checklist

  • I have read the contributing document.
  • I have used hugo to render the site/docs locally and I am sure it works.

@CLAassistant
Copy link

CLAassistant commented Sep 22, 2020

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@harsha509 harsha509 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Peyton88 ,

Thanks for the PR!

get Element css value actually returns a value of computed css style property of an element. we have WebDriver method like getCssValue in JS. The code sample you've provided is for getAttribute

i've updated doc with a code sample for JS. https://www.selenium.dev/documentation/fr/webdriver/web_element/#get-element-css-value

can you please update the code samples accordingly.

Thank you !

@Peyton88
Copy link
Contributor Author

Hi @Peyton88 ,

Thanks for the PR!

get Element css value actually returns a value of computed css style property of an element. we have WebDriver method like getCssValue in JS. The code sample you've provided is for getAttribute

i've updated doc with a code sample for JS. https://www.selenium.dev/documentation/fr/webdriver/web_element/#get-element-css-value

can you please update the code samples accordingly.

Thank you !

Thanks. I got a misunderstanding.
I've updated my commit.

Copy link
Member

@harsha509 harsha509 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @Peyton88 ,

Thank you for making the changes. and apologies for reverting it, there are couple of things required to get this pr merged !

  1. Can you please fill/complete the above checklist.
  2. Semicolons are not required in few language bindings like kotlin, ruby, python can you please look into the suggested changes
  3. Can you please make the same changes in other translated pages too like (es,fr,zh-cn).

Thank you!

driver.get 'https://www.example.com'

# Retrieves the computed style property 'color' of linktext
cssValue = driver.find_element(:link_text, 'More information...').css_value('color');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cssValue = driver.find_element(:link_text, 'More information...').css_value('color');
cssValue = driver.find_element(:link_text, 'More information...').css_value('color')

// Please provide a pr for the code sample

// Navigate to Url
driver.get('https://www.example.com');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
driver.get('https://www.example.com');
driver.get('https://www.example.com')

driver.get('https://www.example.com');

# Retrieves the computed style property 'color' of linktext
cssValue = driver.findElement(By.LINK_TEXT, "More information...").value_of_css_property('color');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cssValue = driver.findElement(By.LINK_TEXT, "More information...").value_of_css_property('color');
cssValue = driver.findElement(By.LINK_TEXT, "More information...").value_of_css_property('color')

// Please provide a pr for the code sample

# Navigate to Url
driver.get('https://www.example.com');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
driver.get('https://www.example.com');
driver.get('https://www.example.com')

driver.get('https://www.example.com');

// Retrieves the computed style property 'color' of linktext
val cssValue = driver.findElement(By.linkText("More information...")).getCssValue('color');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
val cssValue = driver.findElement(By.linkText("More information...")).getCssValue('color');
val cssValue = driver.findElement(By.linkText("More information...")).getCssValue('color')

@Peyton88
Copy link
Contributor Author

Peyton88 commented Sep 26, 2020

hi @Peyton88 ,

Thank you for making the changes. and apologies for reverting it, there are couple of things required to get this pr merged !

  1. Can you please fill/complete the above checklist.
  2. Semicolons are not required in few language bindings like kotlin, ruby, python can you please look into the suggested changes
  3. Can you please make the same changes in other translated pages too like (es,fr,zh-cn).

Thank you!

Hi @harsha509 ,

Thanks for your kindly reminding.
Please see my updates.

Copy link
Member

@harsha509 harsha509 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @Peyton88 !

@harsha509
Copy link
Member

deploy-preview looks good !

@harsha509 harsha509 merged commit bae2e36 into SeleniumHQ:dev Sep 27, 2020
selenium-ci added a commit that referenced this pull request Sep 27, 2020
@harsha509
Copy link
Member

Congratulations on your first contribution @Peyton88 🎉 🎉 🎉 🎉 🎉

@Peyton88
Copy link
Contributor Author

Congratulations on your first contribution @Peyton88 🎉 🎉 🎉 🎉 🎉

Thanks you~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants