I’m using Selenium with Python and Phantomjs. I want to click a button
from the youtube page, but it always gives an error. Someone can help me?
Which code do you already have, and where is the error? Which button? It’s impossible to help you if you don’t provide more information. Welcome http://answall.com/tour
It’s the "Show More" button on the side. The code is: "driver = webdriver.Phantomjs() driver.get("https://www.youtube.com/watch?v=uyWX8hdknvU") driver.find_element_by_class_name("yt-uix-button yt-uix-button-size-default yt-uix-button-Expander")
What he told you is that you are trying to use a class name that has spaces... making it a "compound class" or "compound class".. Try using another selector to pick a simple class... for example b = driver.find_element_by_xpath('//span[@class="yt-uix-button-content"') and then click on the selected object using b.click()
Which code do you already have, and where is the error? Which button? It’s impossible to help you if you don’t provide more information. Welcome http://answall.com/tour
– Miguel
It’s the "Show More" button on the side. The code is: "driver = webdriver.Phantomjs() driver.get("https://www.youtube.com/watch?v=uyWX8hdknvU") driver.find_element_by_class_name("yt-uix-button yt-uix-button-size-default yt-uix-button-Expander")
– Leon Cruz
What he told you is that you are trying to use a class name that has spaces... making it a "compound class" or "compound class".. Try using another selector to pick a simple class... for example
b = driver.find_element_by_xpath('//span[@class="yt-uix-button-content"')
and then click on the selected object usingb.click()
– dot.Py