Getting past Javascript popups

I'm trying to automate several web tasks. For the current task i want to scape all the ids of page and then submit it to the server. The scraping part goes well but then a java script pops requiring me to click ok, How do I get around this or interact with this system to pass the data