0

I am using selenium webdriver to click on the javascript onclick element. Once it is clicked, I want to parse the content of clicked element using BeautifulSoup. Here is my code to click the element.

from selenium import webdriver
driver = webdriver.Chrome()
url='https://www.mobikwik.com/'
driver.get(url)
el = driver.find_element_by_css_selector(".check-plans.ng-scope")
el.click()

Now I want to further parse the plans which I can see. How can I do this?

Nitin Vijay
  • 435
  • 1
  • 8
  • 14
  • So, if you want to parse content with `BeautifulSoup`, then import it and use appropriately. What's the problem? Can you describe specific issue you encountered? – Andersson Feb 13 '17 at 08:31
  • select the element you want to get. after the click() – nivhanin Feb 13 '17 at 09:00

1 Answers1

0

If you feed the html of the page that driver loaded from the driver into beautiful soup you can then navigate it as a parsed page. Find the element you are looking for again with a soup.find() and then you can navigate it accordingly.

soup = BeautifulSoup(el.text, 'html5lib')

Look here for reference to a similar question.

Community
  • 1
  • 1
B.Adler
  • 1,499
  • 1
  • 18
  • 26