Discussion:
[selenium-users] Selenium find object by XPATH error..
Prasanth 007
2018-11-30 04:03:08 UTC
Permalink
Hi

I working on something like below. I have web application which accepts
Username and password. Now my requirements is to write a program:

-

Login to that web application with port. For example.

http://abecdefgh:1101
-

And then in that main page, there will be Username and Password Fields
and a OK button.
-

I need to fill username and password and login
-

once its login into application, there will be one text tab called
buckets, I need to click on that, it will show item count and so on...
-

Now I need screen capture (screenshot) now and save it to some location

So tried below code.. till line 12 its working correctly. Its logging in
with username and password supplied and then i need program to click on tab
called buckets, i am using xpath to identify the object and trying to click
but its not working...can you please suggest.

from selenium.common.exceptions import TimeoutExceptionfrom 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()
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+***@googlegroups.com.
To post to this group, send email to selenium-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/7297e9f6-f687-47d7-8b70-8e26a0514cf8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Prasanth 007
2018-11-30 12:59:39 UTC
Permalink
Now I am to reach final page as intended, but for taking screenshot,
program is not getting latest url of final page, it still says, current url
is main page.

any idea , how to get value redirect url.. However, this final page is not
being opened in new windoe, but in same window
Post by Prasanth 007
Hi
I working on something like below. I have web application which accepts
-
Login to that web application with port. For example.
http://abecdefgh:1101
-
And then in that main page, there will be Username and Password Fields
and a OK button.
-
I need to fill username and password and login
-
once its login into application, there will be one text tab called
buckets, I need to click on that, it will show item count and so on...
-
Now I need screen capture (screenshot) now and save it to some location
So tried below code.. till line 12 its working correctly. Its logging in
with username and password supplied and then i need program to click on tab
called buckets, i am using xpath to identify the object and trying to click
but its not working...can you please suggest.
from selenium.common.exceptions import TimeoutExceptionfrom 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)
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+***@googlegroups.com.
To post to this group, send email to selenium-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/0aaa093f-e962-48b8-b34a-b07ef688dbbb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...