Created
January 15, 2013 18:10
-
-
Save adamgoucher/4540597 to your computer and use it in GitHub Desktop.
ideas on how to mark browsers as being remote or not -- or more accurately whether they can use the localfiledetecter that is in send_keys. with the additional twist of being a wrapper around webdriver and not being in the project itself
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Remote(object): | |
| IS_A_REMOTE_BROWSER = True | |
| def send_keys(self): | |
| if self.IS_A_REMOTE_BROWSER: | |
| print('%s is a remote' % self.__class__.__name__) | |
| print('send_keys') | |
| class Firefox(Remote): | |
| IS_A_REMOTE_BROWSER = False | |
| class Tailored(Remote): | |
| IS_A_REMOTE_BROWSER = True | |
| if __name__ == '__main__': | |
| Firefox().send_keys() | |
| Remote().send_keys() | |
| Tailored().send_keys() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Remote(object): | |
| def send_keys(self): | |
| if self.__class__.__name__ not in ['Firefox']: | |
| print('%s is a remote' % self.__class__.__name__) | |
| print('send_keys') | |
| class Firefox(Remote): | |
| pass | |
| class Tailored(Remote): | |
| pass | |
| if __name__ == '__main__': | |
| Firefox().send_keys() | |
| Remote().send_keys() | |
| Tailored().send_keys() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment