-
Notifications
You must be signed in to change notification settings - Fork 72
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
Temporarily disable/enable "automation build" Extension #46
Comments
You're right, the graphical build has a way to export settings encoded as a URL - see documentation. However, this URL will not work in the automation build. The reason for this is because settings are imported via manifest.json and the extension cannot write to it. It would be useful to understand why you need this feature. For example, if you want to the extension to not run on certain pages, you can add the URL of the page to ignore in the |
One example is when I need to solve a captcha to submit a form and I am only interessted in the error feedback. I don't need to solve the captcha again when the form with error messages is displayed again. |
I agree with @StigP1337 , such a feature to change settings on the fly would be useful. Although my issue is a bit different I felt it's similar enough to keep it in this post. I'd like to be able to use the Magic URL in the automation build to update which nopecha key to use when one key runs out of credits. I did notice the |
The
|
Thanks @Le0Developer , looking forward to that multi-key support. In the meantime perhaps @StigP1337 can use the solution I discovered. In order to disable the autmation build version of the extension without closing your selenium browser session you can use For example: def re_enable_nopecha_ext(driver):
driver.get('chrome://extensions/'); time.sleep(1)
# Enable Developer mode using JavaScript
driver.execute_script(
'document.querySelector("extensions-manager").shadowRoot.querySelector("extensions-toolbar").shadowRoot.querySelector("#devMode").click()')
time.sleep(1)
# Construct the JavaScript command to click the enable/disable toggle button
disable_script = f"""
var manager = document.querySelector("extensions-manager").shadowRoot;
var item = manager.querySelector('extensions-item-list').shadowRoot.querySelector('extensions-item[id="{nopecha_extension_id}"]').shadowRoot;
item.querySelector('cr-toggle[aria-label="On, extension enabled"]').click();
"""
enable_script = f"""
var manager = document.querySelector("extensions-manager").shadowRoot;
var item = manager.querySelector('extensions-item-list').shadowRoot.querySelector('extensions-item[id="{nopecha_extension_id}"]').shadowRoot;
item.querySelector('cr-toggle[aria-label="Off"]').click();
"""
driver.execute_script(disable_script)
time.sleep(1)
driver.execute_script(enable_script)
print("Extension reloaded") For my own project I edit the |
Or alternatively disable auto-open and open the captcha yourself. |
Thank you @jakeee51 and @Le0Developer for the replies. I will try the suggested solutions. |
I am currently using the "automation build" Version of the Extension. Is there a way to temporarily disable the Extension from my Python Selenium script when captcha solving is not needed or not wanted?
With the "graphical build" Version I could use the Magic URL (https://nopecha.com/setup#enabled=false) to disable and enable the extension from my script when I need too.
This doesn't work in the "automation build" Version. Is their another way to achieve the same behaviour with this version? Or do you have plans to add such a feature?
Other extensions offer the possibility to use Javascript to change settings or to turn it off/on. Maybe you can add such a way to your extension?
The text was updated successfully, but these errors were encountered: