Skip to content

Convert int/float inputs to strings before typing text #702

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 3 commits into from
Sep 22, 2020

Conversation

mdmintz
Copy link
Member

@mdmintz mdmintz commented Sep 22, 2020

Convert int/float inputs to strings before typing text

  • Convert integer inputs to strings before typing text
  • Also update the cffi requirement to cffi==1.14.3

The fix for this is simple:

if type(text) is int or type(text) is float:
    text = str(text)

This conversion is necessary to prevent errors from occurring in:

if not text.endswith('\n'):
    element.send_keys(text)
else:
    element.send_keys(text[:-1])
    element.send_keys(Keys.RETURN)

Most text-typing methods already fixed this. Now they all fix it.

  • Fixed methods:
self.add_text(selector, text)
self.send_keys(selector, text)  # Same as self.add_text()

@mdmintz mdmintz merged commit 57faf6f into master Sep 22, 2020
@mdmintz mdmintz deleted the convert-int-to-str-before-typing-text branch September 22, 2020 15:19
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.

1 participant