Set the context that Selenium commands are running in using a `with` statement. The state of the context on the server is saved before entering the block, and restored upon exiting it. Args: context: Context, may be one of the class properties `C
(self, context)
| 81 | |
| 82 | @contextmanager |
| 83 | def context(self, context): |
| 84 | """Set the context that Selenium commands are running in using a `with` statement. |
| 85 | |
| 86 | The state of the context on the server is saved before entering the block, |
| 87 | and restored upon exiting it. |
| 88 | |
| 89 | Args: |
| 90 | context: Context, may be one of the class properties |
| 91 | `CONTEXT_CHROME` or `CONTEXT_CONTENT`. |
| 92 | |
| 93 | Example: |
| 94 | with selenium.context(selenium.CONTEXT_CHROME): |
| 95 | # chrome scope |
| 96 | ... do stuff ... |
| 97 | """ |
| 98 | initial_context = self.execute("GET_CONTEXT").pop("value") |
| 99 | self.set_context(context) |
| 100 | try: |
| 101 | yield |
| 102 | finally: |
| 103 | self.set_context(initial_context) |
| 104 | |
| 105 | def install_addon(self, path, temporary=False) -> str: |
| 106 | """Installs Firefox addon. |
nothing calls this directly
no test coverage detected