kaliiiiiiiiii / Selenium-Profiles

undetected Selenium using chromedriver and emulation / device profiles
Other
255 stars 29 forks source link

Unable to get href attribute #110

Closed wealthr closed 4 months ago

wealthr commented 7 months ago

Code works well with selenium and print's out the attribute, but with selenium-profile i get "none" printed out for the url, but prints out the h3 element text.

Here's My Code : `from selenium_profiles.webdriver import Chrome from selenium_profiles.profiles import profiles from selenium_driverless.webdriver import ChromeOptions from selenium_driverless.types.by import By

profile = profiles.Windows() # or .Android options = ChromeOptions()

options.add_argument("--headless=new")

driver = Chrome(profile, options=options, driverless_options=True)

get url

driver.get('https://www.google.com/search?q=python') # test fingerprint

Find all h3 elements within search results

h3_elements = driver.find_elements(By.CSS_SELECTOR, 'h3')

Print the text of each h3 element

for h3_element in h3_elements: url = h3_element.get_attribute('href') print(h3_element.text) print(url)

driver.quit() # Execute on the End! `

kaliiiiiiiiii commented 7 months ago

@wealthr please

  1. Provide your code in the following format:
    import blablabla
    # some code ...
  2. Update your driverless version & try again.
wealthr commented 7 months ago

i have updated the driverless version and same issue


from selenium_profiles.webdriver import Chrome
from selenium_profiles.profiles import profiles
from selenium_driverless.webdriver import ChromeOptions
from selenium_driverless.types.by import By

profile = profiles.Windows()  # or .Android
options = ChromeOptions()
# options.add_argument("--headless=new")
driver = Chrome(profile, options=options, driverless_options=True)

# get url
driver.get('https://www.google.com/search?q=python')  # test fingerprint

# Find all h3 elements within search results
h3_elements = driver.find_elements(By.CSS_SELECTOR, 'h3')

# Print the text of each h3 element
for h3_element in h3_elements:
    url = h3_element.get_attribute('href')
    print(h3_element.text)
    print(url)

driver.quit()  # Execute on the End!
`
wealthr commented 7 months ago

hello @kaliiiiiiiiii

kaliiiiiiiiii commented 7 months ago

hello @kaliiiiiiiiii

Great, thanks! I'll test your code & lyk:)

wealthr commented 7 months ago

Alright, thanks

wealthr commented 7 months ago

any update please @kaliiiiiiiiii

kaliiiiiiiiii commented 4 months ago

That's due to how selenium-driverless works. Let's close this issue, as driverless is not scope of this project.