top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration
Print Preview

capture html screen with pexpect when using python

0 votes

I can log into a web site with pexpect but what I want to do is pipe the opening window to a file. Logging into the site opens the site window but I can't get the window to a file.

I can't use screen capture I need to get pexpect to pipe it to a txt file.

posted Jul 8, 2013 by anonymous

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

1 Answer

+1 vote

What have you tried? What environment are you in? What's the exact assignment?
I'd use wget, since I'm on Linux, and it's simple.

$ wget
creates a file called index.html in my cwd

answer Jul 8, 2013 by anonymous
Similar Questions
+1 vote

I want the javascript API which could capture the screen of the client. Does anyone knows about it?

–1 vote

I'm working on a new project and i want to receive a request from a user and to redirect him to a third party site, but on the page after i redirect my users i want to them to see injected html (on the third party site.)

i'm not really sure how to approach this problem..

+2 votes

I have to do the following operation in python script

  1. Open a port using screen command, (USB COMPORT)
  2. execute a command
  3. wait for the result (next line of command)
  4. Compare the result
  5. Close the port
0 votes

Sorry for the vague title. Probably best to just show you the code that explains it better.

This is a simplified example of what I want to do:

from random import choice

class Expr(object):
 Expr(expr, op, val) -> an expression object.

 def __init__(self, expr, op='', val=''):
 self.expr = expr # can be another instance of Expression.
 self.op = op
 self.val = val

 def __str__(self):
 return ("%s %s %s" % (self.expr, self.op, self.val)).strip()

 def expand(self):
 self = Expr(self, choice('+-*/'), choice('12345'))

Then I tried messing around with Expr.__new__() and Expr.__init__() but that didn't work.

The only way I've got it to work is by doing the expanding part outside of the object, by a method of some other class. But I want the Expr class to be responsible for itself. How can I do this and why doesn't the above work?

Useful Links with Similar Problem
Contact Us
+91 9880187415
#470/147, 3rd Floor, 5th Main,
HSR Layout Sector 7,
Bangalore - 560102,
Karnataka INDIA.