Greasemonkey script for clicking a button in a webpage - greasemonkey

Can someone post the grease monkey script that will automatically push a button in a webpage every 10 or 15 minutes?

Related

How can I scroll or control chromium browser or Chrome webpage using selenium and python3.7? [duplicate]

This question already has answers here:
ElementClickInterceptedException: Message: element click intercepted Element is not clickable error clicking a radio button using Selenium and Python
(1 answer)
ElementClickInterceptedException: Message: element click intercepted: Element <label> is not clickable with Selenium and Python
(2 answers)
Closed 2 years ago.
I have a specific python3 code/script that I have written to automate with selenium for writing of some form in a webpage. the issue arises when the form input box is present down the webpage. So much down that I have to scroll down before the script gets executed. If I don't scroll down the following error gets displayed
'''selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element is not clickable at point (144, 1018)
(Session info: chrome=78.0.3904.108)'''
A little description of the webpage, there are 16 form boxes in 4x4 pattern, i.e. web page has 4 rows and 4 columns. At the extreme bottom there is button of 'save' that needs to be clicked after the forms are filled properly. The problem now is that while the selenium 'send.keys' does its job perfectly the 'driver.find_element_by_xpath('the_x_path').click()' doesn't do its job. Rather the 'driver.click()'. Command does scroll to the option but doesn't actually click. I have tried typing the same code (driver.find_element_by_xpath('the_x_path').click()) twice but doesn't yield any results except the above code. Now as I have said previously if I manually scroll down the webpage while the script is catching up the script works perfectly so if there is any way to scroll down or up the webpage, I need help with that. Another way is as I've discussed with all of you above in the 5th line of this paragraph. the first click() command does navigate to the actual button/link but doesn't does the actualy 'click'. Instead throws up the above error, so my proposition is that if I type the same command then it might help. Well I still don't have much faith in the 2nd proposal. need some help thus. Really appreciate for reading this out. Thanks.

Is it possible for a chrome extension popup not to wait for background scripts to load?

Intro
I have a chrome extension I am working on, that uses the background page to listen to the following window and tab events:
chrome.tabs.onActivated
chrome.tabs.onUpdated
chrome.windows.onFocusChanged
The background process basically retrieves the HTML source from each qualifying page the user visits, via a content script injection and messaging.
Once the message with the HTML source is received in the background page, it performs specific tests which may take anywhere from few to several of seconds, depending on the source size.
The Problem
I found that each time I click on the extension icon to open the popup.html view, it renders my background page again and runs the HTML collection and analysis. The issue is the popup view window doesn't open until the background has finished, which on certain pages may take 5-10 seconds.
I tried running the entire background page async with setTimeout(function(){..},0) which didn't work..
How can I solve this?
Is there a way that the popup page will not render the background again? This happens anyway when the user views the tab, so I don't need it?
If not, is there a way for the popup to display regardless of the background operation?
any other suggestions?
Thanks!

Handling Modal Dialog box from webpage in watir

So I'm writing a watir-webdriver test script, and my webpage is using javascript:window.print to present a modal window that I want to interact with. When I click the link that presents the modal window, watir-webdriver just sits there until eventually it times out and i see a Timeout::Error on the console window. This is before attempting to interact with the new window at all. how do I tell it to move on without waiting?
After that whole execution is not responsive. Its not proceeding with next execution it gets struck there. tried the below solution too
element.focus element.send_keys :return
but no luck, Could anyone know how to resolve this modal dialogbox from webpage.
Thanks
get
I am using Firefox with Watir-webdriver.
browser.a:(:href => 'javascript:window.print()').click
this opens the Print dialog box. Which is the normal print dialog box from teh Firefox browser.
It just waits here and doesn't execute anything after that till i click manually or it timesout.

How to close a fixed div with javascript

I have problem! I have just created a div with fixed position! I have put a close button for this div and i wanna if someone clicked on the button, the button would hide for just 24 hours, i wrote some codes to hide it but the problem is i cant set a time for it, can help me?
I don't know if you are still interested in the solution. You can do this using cookies. Write a cookie to the users browser for the time of the click (close button click), and next time he visits your site check the value of this cookie against the current server time to see how much time has passed since he clicked the close button.
For this to work, cookies should be enabled on your user's browser of course.

chrome extension popup not open immediately

I'm writing a chrome extension.
When i click the browser action button in the first time - all goes well.
When i click the browser action button the second time, after several minutes of not clicking it, it takes more than 10 seconds until the popup is shown.
I've tried commenting out all of the periodic methods in the background and all of the methods in the load event of the popup, but it still doesn't shown immediately.
any suggestions?
I had a similar issue with the popup when I was adding an iframe to the popup. Chrome would wait with showing the popup until that iframe was loaded.
For me the fix was wrapping the code that added the iframe to the HTML in:
setTimeout(function(){
// Code here
},0);
This way Chrome showed the popup first, after which it begin with loading the iframe.
Maybe you have a similar problem?
i have seen this behavior before when you have a long running ajax call that you are doing on popup load.. hard to tell further without code samples or description of what you are doing

Resources