0

Can I extract JavaScript code using Python Selenium, In other words, i need the js code as string

function validateForm() {
  var x = document.forms["myForm"]["Password"].value;
  if (x.length >= 6) {
    
  }
}
4
  • Where that function declaration is located? Show your code Commented Feb 15, 2021 at 15:47
  • form onsubmit="validateForm()" Commented Feb 15, 2021 at 15:53
  • @JaSON I don't have source code for the web application because I work on implementing crawling to analyze JS code. So I need the JS code as a string to extract specific information. I need the steps to do that. Commented Feb 15, 2021 at 16:00
  • Does it help in any way? stackoverflow.com/a/35948978/7610724 Commented Feb 15, 2021 at 16:29

1 Answer 1

1

you can use BeautifulSoup

soup = BeautifulSoup(response.content,'html.parser')
script_code = soup.find('script')
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.