Small adjustment to stackoverflow example
This commit is contained in:
@@ -11,6 +11,8 @@ page = Adaptor(response.text, url=response.url)
|
|||||||
# First we will extract the first question title and its author based on the text content
|
# First we will extract the first question title and its author based on the text content
|
||||||
first_question_title = page.find_by_text('Run Selenium Python Script on Remote Server')
|
first_question_title = page.find_by_text('Run Selenium Python Script on Remote Server')
|
||||||
first_question_author = page.find_by_text('Ryan')
|
first_question_author = page.find_by_text('Ryan')
|
||||||
|
# because this page changes a lot
|
||||||
|
if first_question_title and first_question_author:
|
||||||
# If you want you can extract other questions tags like below
|
# If you want you can extract other questions tags like below
|
||||||
first_question = first_question_title.find_ancestor(
|
first_question = first_question_title.find_ancestor(
|
||||||
lambda ancestor: ancestor.attrib.get('id') and 'question-summary' in ancestor.attrib.get('id')
|
lambda ancestor: ancestor.attrib.get('id') and 'question-summary' in ancestor.attrib.get('id')
|
||||||
|
|||||||
Reference in New Issue
Block a user