title: Selenium, python: How to extract <head> and all contained the <script> tags on it
body: <p>Im am trying to extract a specific parameter from an html using Selenium, this html has varios scripts inside of it, I am having various issues with this.</p>
  <p>First of all, I want to extract the specific script that contains the pizza functions and form the second pizza function extract the parameter contained in RULER. basically the id in ruler <code>10072345534</code></p>
  <pre><code>&lt;script&gt;script 1&lt;/script&gt;
  &lt;script&gt;script 2&lt;/script&gt;
  ...
  &lt;script&gt;
  
       pizza([&quot;Resource&quot;], function(c) {
          c.registerHighPriHashes([&quot;Ev5Mdytviygiu4I&quot;, &quot;ñlkj8zJdMO4&quot;])
      });
      pizza([&quot;var1&quot;, &quot;var2&quot;, &quot;var3&quot;], function(var1, var2, var3) {
          var1.runWithPriority(3, function() {
              (new var2()).handleWithCustomApplyEach(var3, {
                  
                  &quot;require&quot;: [
                      [&quot;RelayPrefetchedStreamCache&quot;, &quot;next&quot;, [],
                          [&quot;app&quot;, {
                              &quot;box&quot;: {
                                  &quot;complete&quot;: true,
                                  &quot;result&quot;: {
                                      &quot;label&quot;: &quot;EntityHeader&quot;,
                                      &quot;data&quot;: {
                                              &quot;client_handler&quot;: {
                                                  &quot;__typename&quot;: &quot;ActionSearchHandler&quot;,
                                                  &quot;_action&quot;: {
                                                      &quot;name&quot;: &quot;ActionSearch&quot;,
                                                      &quot;RULER&quot;: {
                                                          &quot;id&quot;: &quot;10072345534&quot;
                                                      },
                                                      &quot;id&quot;: &quot;cHJvZmNDQ6NTU6Og&quot;
                                                  },
                                              }
                                          }}, ]]]
              });
          });
      });
      &lt;/script&gt;
  </code></pre>
  <p>First of all I cannot find hoy to extract the  tags followed by the name of the function or something that relates it to the specific place in the code.</p>
  <pre><code>origin = WebDriverWait(self.driver, 10).until(
                          EC.presence_of_all_elements_located((
                              By.XPATH, r'//script[contains(@function_name_pizza)]'))
                      )
  </code></pre>
  <p>The ideal way to solve this problem is by extracting the ID using selenium, but it is also useful to get to the specific script and extract the html contained inside that specific </p>