I want to create a webpage. In it there is a go_to button named goto_button. Whenever the user presses this button the new webpage will be called and the old one will be destroyed. To do this, I have to put a button on the web page, in the html file. However how can I switch from one web page to another? The go_to webpage address is www.kleol.com
if button is pressed
go to web-page kleol // how can I do that?
NOTE: I am new to Django.
Simple HTML tag like the following will work:
Go to Kleol
There's nothing that is django related.It is simple html.
Related
I'm trying to click a button with python and mechanize. The button looks like this:
<span>VOTE NOW!</span>
when going to the link manually, (www.example.com/#vote). It doesn't work. For some reason, it needs to click the button in the browser. I believe it runs a js script as when you click the button a small menu appears, with a form.
I've tried to look at what the form is, and what my script grabs from the main site, and don't find anything close to #vote.
I need to be able to click the button, to access the form, and submit data to the form, but can't find what to 'click'.
Is it possible to save current state of Selenium browser?
To understand I will provide an example:
Let's say that there is a web page. I clicked on the button where I found many other buttons. I want to check each of those buttons sequentially. The problem is that each of this buttons needs to obtain browsers information like referrer which should be the first page after first click etc.
In this case I would need to have those information saved in a browser because if I clicked on the second button the referrer would be page which was recently opened. I can't click on a third right after that. I would have to go back, but some web pages does not allow browsers 'back'. Another advantage is that I would not have to send a new request to the server.
Something like this:
for but in driver.find_elements_by_class_name('button'):
state = driver.save_state()
but.click()
# do stuff
driver.load_state()
There is another solution. The web browser usually uses the cache to save the state of it. Therefore, you can save the cache before clicking each button then reuse the cache to get back to before clicking state.
I already use that solution in my project. It will work perfectly if nothing is saved into database or another third party.
I'm using Python 2.7 with beautifulsoup and urllib2, I'm trying to scrap this page: angel.co/companies
As you see it shows a list with companies and it ends with a button "More" to show the others. As you click the button, more companies appear to watch and it creates a new tag with the new list of resutls. The button is in this div: <div class="more" data-page="2">More</div> and each time you click it the data-page increases.
I'd like to know if it's possible to scrap this page completely (so it clicks the "More" button each time it arrives to the end). I suppose it is scrapping the css and changing it but I never did so and I haven't found information about this anywhere.
Depending on what you want to do you could use their API for this. If you are not sure what it is and how to use it, try googling around for an answer. Here's one for starters.
I want to trigger a button of a html file.
There is a web site in which there are number of options and a button.
After clicking on the button, using the options, a html table is created on next page.
I want to automate the process but I dont know how I can trigger a button using python.
DO anyone knows about the same?
You can use windmill, mechanize or selenium RC.
I have written a script that goes through a bunch of files and snips out a portion of the files for further processing. The script creates a new directory and creates new files for each snip that is taken out. I have to now evaluate each of the files that were created to see if it is what I needed. The script also creates an html index file with links to each of the snips. So I can click the hyperlink to see the file, make a note in a spreadsheet to indicate if the file is correct or not and then use the back button in the browser to take me back to the index list.
I was sitting here wondering if I could somehow create a delete button in the browser next to the hyperlink. My thought is I would click the hyperlink, make a judgment about the file and if it is not one I want to keep then when I get back to the main page I just press the delete button and it is gone from the directory.
Does anyone have any idea if this is possible. I am writing this in python but clearly the issue is is there a way to create an htm file with a delete button-I would just use Python to write the commands for the deletion button.
You could make this even simpler by making it all happen in one main page. Instead of having a list of hyperlinks, just have the main page have one frame that loads one of the autocreated pages in it. Put a couple of buttons at the bottom - a "Keep this page" and a "Delete this page." When you click either button, the main page refreshes, this time with the next autocreated page in the frame.
You could make this as a cgi script in your favorite scripting language. You can't just do this in html because an html page only does stuff client-side, and you can only delete files server-side. You will probably need as cgi args the page to show in the frame, and the last page you viewed if the button click was a "delete".
You would have to write the web page in Python. There are many Python web frameworks out there (e.g. Django) that are easy to work with. You could convert your entire scripting framework to a web application that has a worker thread going and crawling through html pages, saving them to a particular location, indexing them for you to see and providing a delete button that calls the system's delete function on the particular file.
Rather than having your script output static HTML files, with a little amount of work you could probably adapt your script to run as a small web application with the help of something like web.py.
You would start your script and point a browser at http://localhost:8080, for instance. The web browser would be your user interface.
To achieve the 'delete' functionality, all you need to do is write some Python that gets executed when a form is submitted to actually perform the deletion.
Well I finally found an answer that achieved what I wanted-I did not want to learn a new language-Python is hard enough given my lack or experience
def OnDelete(self, event):
assert self.current, "invalid delete operation"
try:
os.remove(os.path.join(self.cwd, self.current))