= Editing Questions = To edit the title and description of question, one uses the 'Edit Question' menu item. You need to be logged in to perform that action: >>> anon_browser.open('http://launchpad.dev/firefox/+question/2') >>> anon_browser.getLink('Edit question').click() Traceback (most recent call last): ... Unauthorized... >>> user_browser.open('http://launchpad.dev/firefox/+question/2') >>> user_browser.getLink('Edit question').click() >>> print user_browser.url http://answers.launchpad.dev/firefox/+question/2/+edit There is a cancel link should the user decide otherwise: >>> print user_browser.getLink('Cancel').url http://answers.launchpad.dev/firefox/+question/2 When we post the form, we should be redirected back to the question page. >>> description = ( ... "Hi! I'm trying to learn about SVG but I can't get it to work at " ... "all in firefox. Maybe there is a plugin? Help! Thanks. Mark") >>> user_browser.getControl('Description').value = description >>> summary = "Problem showing the SVG demo on W3C web site" >>> user_browser.getControl('Summary').value = summary >>> user_browser.getControl('Save Changes').click() >>> print user_browser.url http://answers.launchpad.dev/firefox/+question/2 And viewing that page should show the updated information. >>> soup = find_main_content(user_browser.contents) >>> print soup.first('div', 'report').renderContents().strip()
Hi! I'm trying to learn about SVG but I can't get it to work at all in firefox. Maybe there is a plugin? Help! Thanks. Mark
>>> print soup.first('h1').renderContents() Problem showing the SVG demo on W3C web site You can even modify the title and description of 'Answered' and 'Invalid' questions: >>> def print_question_status(browser): ... print extract_text( ... find_tag_by_id(browser.contents, 'question-status')) >>> user_browser.open('http://launchpad.dev/ubuntu/+question/3') >>> print_question_status(user_browser) Status: Invalid >>> user_browser.getLink('Edit question')