XPath locator is not Working on this webpage [closed] - python

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I would like to click the Table of content list using Xpath, but Xpath is completely not working in this URL
https://www.hindawi.com/journals/ecam/contents/

Use CSS Selector in place of XPath as follow :
CSS Selector : a[href='/journals/ecam/2019/']
Code to click :
content = driver.find_element_by_css_selector("a[href='/journals/ecam/2019/']")

I don't know why you are having problems with XPath...
This code snip works fine for me:
from selenium import webdriver
driver = webdriver.Chrome(r'C:\path\to\chromedriver.exe')
driver.get('https://www.hindawi.com/journals/ecam/contents/')
driver.find_element_by_xpath('//*[#id="TableofContentsNav"]').click()
all_links = driver.find_elements_by_xpath('//*[#class="middle_content"]//*[#href]')
for i in all_links:
print(i.get_attribute('href'))
Hope you find this helpful!

Related

can we request a particular div in python [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I want to access a website's particular div,
can I access it?
if we can pls share an example.
I have watched many videos on this but all videos are for tables only(mostly)
Yes, you can, using beautiful soup.
For example, you can refine your search to only find those divs with a given class:
mydivs = soup.find_all("div", {"class": "class_to_find"})
Take a look here :
https://beautiful-soup-4.readthedocs.io/en/latest/
Use Beautiful Soup, a python library which can work with HTML/XML files.
soup.find('div', class_='your_div_class')
soup.select('div.your_class_name')[0]

Perform a click on a web app with selenium python [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I am trying to scrape or crawl this web app (https://www.ea.com/en-gb/fifa/ultimate-team/web-app/)
I not sure if its because its a web app or some anti scraper measures but nothing is happening when I attempt to click the login button.
the button is clicked but doesn't show anything.
Code
driver = webdriver.Chrome('/Users/Downloads/chromedriver')
driver.get("https://www.ea.com/en-gb/fifa/ultimate-team/web-app/")
driver.implicitly_wait(20)
driver.find_element_by_xpath('//*[#id="Login"]/div/div/button[1]').click()
Try this code :
driver = webdriver.Chrome('/Users/Downloads/chromedriver')
driver.get('https://www.ea.com/en-gb/fifa/ultimate-team/web-app/')
driver.implicitly_wait(20)
driver.find_element_by_xpath('//*[#id="Login"]/div/div/button[1]').click()
you simply didn't add the quotes to the url

How do I find CSS Selector of slider on webpage? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I dont really have any experience with CSS but for a python selenium script im writing I need to figure out how I find the CSS selector of the slider on the bottom of this webpage https://www.publish0x.com/blockchain-insights/millennials-and-crypto-xvwykyo
When I try to use the option 'copy selector' while selecting the element I only get #tipslider which doesn't seem to be it.
it seem to be it actually...
the input[type=range] is a special HTML element which represents a range slider.
you can change the value of it by changing the value attribute!
Fixed it. The #tipslider actually did work.

Python Automation [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I'm trying to capture a test case result where table content Search/filter output need to cross check each time when the test run. I have attached a table grid that I need to use to search/filter. I'm using python script for the automation.
Any suggestion?
You can use selenium to test. The table's inner HTML can be accessed using
table_content = element.get_attribute('innerHTML').
you can parse that HTML to cross check your results.
Have a look at this question for reference.
Get HTML Source of WebElement in Selenium WebDriver using Python

automate web browsing using python [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
from selenium import webdriver
chromedriver = 'C:\\chromedriver.exe'
browser = webdriver.Chrome(chromedriver)
browser.get('http://www.example.com')
Then, how can I click on the third Download button?
You can use a xpath expresion to get all inputs with a "Download" value, and click the third:
browser.find_elements_by_xpath('//input[#value="Download"]')[2].click()

Categories

Resources