So hello! First of all. I'm not very familiar with python and selenium that's why i need your help! The story: I want to make an IMVU auto badge collector for my gf which means you type a url that you want to collect badges from then it will automatically collects for you. (To collect badges you have to click a span) I writed the beggining of the code so i can login automatically and start to collect BUT some weird things are happening. When i'm not login the program can click on the spans but when i login it can't. Why? The id and the class is the same. I tried lot of thing: i changed the find_element to xpath, when i login i tried to make a new window then collect there etc. but nothing happened. Can somebody help me? I would be very happy!
here is the code:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import time
from selenium.webdriver.common.keys import Keys
PATH = "C:\chromedriver\chromedriver.exe"
options = Options()
options.headless = False
options.add_argument("--mute-audio")
driver = webdriver.Chrome(PATH, options=options)
def login():
driver.get("https://secure.imvu.com/welcome/login/")
time.sleep(3)
driver.find_element_by_xpath('/html/body/section/div/div/div/section/div/div/button').click()
driver.find_element_by_xpath('//*[@id="__default__"]/div[1]/div[2]/div/div[2]/div/ul/a').click()
time.sleep(3)
username = driver.find_element_by_xpath('/html/body/div[6]/section[2]/div/div/div/section/form/div[1]/input')
password = driver.find_element_by_xpath('/html/body/div[6]/section[2]/div/div/div/section/form/div[2]/div[2]/input')
username.send_keys("username")
password.send_keys("password")
time.sleep(3)
driver.find_element_by_xpath('/html/body/div[6]/section[2]/div/div/div/section/form/div[4]/button').click()
time.sleep(5)
def claim():
#driver.get("https://secure.imvu.com/welcome/login/")
#input("Press Enter to continue...")
#driver.execute_script('''window.open("https://avatars.imvu.com/qub","_blank");''')
#time.sleep(3)
driver.get("https://avatars.imvu.com/qub")
time.sleep(5)
driver.find_element_by_xpath("//span[contains(@id,'grant-badge-74354585-1')]").click()
time.sleep(5)
#driver.find_element_by_xpath('/html/body/table[1]/tbody/tr/td/table[2]/tbody/tr/td[1]/div/div[4]/table/tbody/tr/td/div/div/table/tbody/tr[1]/td[1]/span').click()
login()
claim()