Can t find the xpath for Following button instagram for selenium - TagMerge
3Can t find the xpath for Following button instagram for seleniumCan t find the xpath for Following button instagram for selenium

Can t find the xpath for Following button instagram for selenium

Asked 1 years ago
0
3 answers

Selenium does Not "like" empty or white spaces in the attributes.

I suggest using a CSS selector and using *= in order to find text contains:

driver.find_element_by_CSS('//div[class*="qF0y9"][class*="Igw0E"]').click();

Avoid using white or empty spaces and, underscores (_) and hyphens (-) for the element's attributes.

Source: link

0

First, we must install a selenium library on our terminal such as the code below:
pip install selenium
Once it has been done, then we must install some python libraries required such as time and requests like the code below:
pip install time
and
pip install requests
Here the code about importing the required libraries for scraping using selenium:
from selenium import webdriverfrom selenium.webdriver.common.keys import Keysimport time, urllib.requestimport requests
The PATH code is the code that aims to connect our code with the browser. Here the code logic about PATH is below:
PATH = r"C:\download\chromedriver_win32\chromedriver.exe"driver = webdriver.Chrome(PATH)

Source: link

0

XPath = //tagname[@Attribute=’Value’]
1

XPath = //tagname[@Attribute=’Value’]
/html//div/div/div/div[1]/div/a/img
1

/html//div/div/div/div[1]/div/a/img
//img[@alt='LambdaTest']
1

//img[@alt='LambdaTest']
XPath = //tagname[@Attribute=’Value’]
1

XPath = //tagname[@Attribute=’Value’]
//tagname[contains(@attribute,constantvalue)]
1

//tagname[contains(@attribute,constantvalue)]

Source: link

Recent Questions on selenium

    Programming Languages