title: I want to click 2 buttons sequentially in selenium python
body: <p>The site I use has 2 download buttons, PNG and PSD.
  <a href="https://i.stack.imgur.com/74V6v.png" rel="nofollow noreferrer">Image of 2 download buttons</a></p>
  <p>Currently I just clicked the PSD button to get the download link.Because when clicking the button it doesn't open a new tab but uses the current tab.</p>
  <p>I want to press 2 JPG and PSD buttons at the same time to get the download link in the input box of each tab.</p>
  <p>Soucre sample code of a file on the site I make: <a href="https://view-source:https://lovepik.com/image-401238137/graduation.html" rel="nofollow noreferrer">view-source:https://lovepik.com/image-401238137/graduation.html</a></p>
  <p>This is the code I got the download link at the PSD button:</p>
  <pre><code>                 try:
                      psd = driver.find_element(By.XPATH, '//div[@class=&quot;pub jpg_psd&quot;]//*[@class=&quot;pub_s psd_s&quot;]')
  
                      # jpg = driver.find_element(By.XPATH, '//div[@class=&quot;pub jpg_psd&quot;]//*[@class=&quot;pub_s jpg_s&quot;]')
  
                      if psd.is_displayed():
                          psd.click()
                          print(&quot;Here is a link with 2 buttons&quot;)
                   except NoSuchElementException:
                         print(&quot;Couldn't find any elements&quot;)
                         content = &quot;The link you entered is incorrect. Please check again.&quot;
                         return render(request, &quot;index.html&quot;, {'form': form, 'link': content})
  
               time.sleep(2)
  
               driver.switch_to.window(driver.window_handles[1])
  
               print(driver.current_url)
  
               try:
                  close_download = driver.find_element(By.XPATH, '//span[@class=&quot;btn_close act_lazy&quot;]')
                  if close_download.is_displayed():
                     close_download.click()
                     print(&quot;Element appears&quot;)
               except NoSuchElementException:
                  print(&quot;Element not found&quot;)
  
            time.sleep(2)
  
            content = driver.find_element(
              By.XPATH, '//input[@class=&quot;copy-ipt link&quot;]').get_attribute(&quot;value&quot;)
  
            print(&quot;Link download is: &quot;, content)
  
            driver.quit()
            return render(request, &quot;index.html&quot;, {'form': form, 'link': content})
  </code></pre>