Python Forum
Taking screenshots with http authentication with username and password from website
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Taking screenshots with http authentication with username and password from website
#1
Dear All,

Is that possible to open a url in chrome and then login with credentials and then click on particular link there ,then taking screenshot of that page via shell script ? I need to open an website like XXXXX.XXXX.XXX.XX:1235 ..there will be two fields for login Username and Password once logged in I need to click a tab mention like bucket and then take screenshot of the screen
My OS : RHEL 7.5
Please give me some direction.

Please guide
Reply
#2
You should take a look at Selenium.
Reply
#3
If it's http authentication (https://developer.mozilla.org/en-US/docs...entication) then you can skip the form entirely, and just submit the credentials to whatever page you want a screenshot of.
Reply
#4
Hi,

I tried below selenium/python code with partial success

from selenium.common.exceptions import TimeoutException
from selenium.webdriver.common.keys import Keys

driver = webdriver.Chrome(executable_path=r'C:\Downloadsnew\chromedriver_win32\chromedriver.exe')
driver.maximize_window()
driver.implicitly_wait(20)
driver.get("http://xxxxx:1091/ui/index.html")

elem = driver.find_element_by_id("login_inp")
elem.send_keys("Administrator")
elem = driver.find_element_by_id("password2_inp")
elem.send_keys("password")
elem.send_keys(Keys.RETURN)
elem.click()
#elem=driver.find_element_by_xpath("//ul[@class='line']")
#elem1.find_element_by_xpath(".//a[@mn-tab='buckets']").click()
elem=driver.find_element_by_xpath("//div[@class='line' and text()='buckets']").click()
Its working till open page , fill username and password and login into page.
But, now I need to click on tab called buckets on screen, for which I am trying to locate the element by XPATH but its not working. Below code is not working.
#elem=driver.find_element_by_xpath("//ul[@class='line']")
#elem1.find_element_by_xpath(".//a[@mn-tab='buckets']").click()
elem=driver.find_element_by_xpath("//div[@class='line' and text()='buckets']").click()
[/python]

when I check inspect url

<div id="headerNav">
    <div class="contents">
      <ul mn-pluggable-ui-tabs="" mn-tab-bar-name="adminTab">
        <li mn-tab="overview" class="line currentNav" ui-sref-active="currentNav">
          <a ui-sref="app.admin.overview" href="#/overview">Overview</a>
        </li>
        <li mn-tab="servers" class="line" ui-sref-active="currentNav">
          <a class="switch_servers" ui-sref="app.admin.servers.list" href="#/servers/active">Server Nodes</a>
        </li>
        <li mn-tab="buckets" class="line" ui-sref-active="currentNav">
          <a class="switch_buckets" ui-sref="app.admin.buckets" href="#/buckets">Data Buckets</a>
        </li><li ng-show="rbac.cluster.admin.internal.all" class="line ng-scope" ui-sref-active="currentNav"><a ui-sref="app.admin.query.workbench" class="ng-binding" href="#/query/workbench">Query</a></li>
        
How to click that buckets ? any suggestions
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Help with screenshots for each 'div class' paunshotts 0 370 Feb-05-2024, 10:19 AM
Last Post: paunshotts
  Taking screenshot ConsistentlyInconsistent 1 1,087 Sep-10-2023, 11:20 PM
Last Post: Larz60+
  saml2 idp sso authentication tiagome 1 2,141 Apr-08-2022, 02:38 PM
Last Post: snippsat
Question Selenium Screenshots store in Database Nuwan16 3 1,996 Oct-05-2020, 02:55 PM
Last Post: Nuwan16
  [split] Pytest-html add screenshots help rafiPython1 1 7,973 Apr-30-2020, 07:16 PM
Last Post: Gourav
  Get username ALFA 2 2,073 Nov-26-2019, 07:33 AM
Last Post: ALFA
  Saving username as first name while adding user in django admin prithvi 0 4,401 Aug-10-2017, 06:50 PM
Last Post: prithvi
  Visiting websites and taking screenshots implicitly? bigmit37 4 4,440 May-01-2017, 04:26 PM
Last Post: bigmit37

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020