I have been working on some RobotFramework stuff and I am having an issue. I am trying to access ta set of links that appear when the settings menu is pressed. I assume that we would need to do some window switching but am having trouble with it as I am pretty new to RF and Python. Would anyone be able to point in the direction of some assistance? I have tried using the documentation but I just cant seem to get it.
Thank you
p.s this is some code where I seem to be getting the issue
Go to http://localhost/index.php?redirect=0
Click Element id:quickaccess-popover-content
Click Element //*[#id="quickaccess-popover content"]/div[2]/div[2]/ul/li[1]/a
Related
I have been trying to scroll through the small pop up window from selenium since a while now. I am trying to create an auto follow bot. But I am unable to either follow or scroll through this. I am trying this code but I don't think I am using a correct Xpath.
How can I get the correct Xpath so that I can scroll through the window?
Also when I try to follow without scrolling it throws an error too. So what can be the possible solution for this?
followers_popup= self.driver.find_element(By.XPATH,'//*.
[#id="mount_0_0_vA"]/div/div/div/div[2]/div/div/div[1]
/div/div[2]/div/div/div/div/div[2]/div/div')
for i in range(5):
self.driver.execute_script("arguments[0].scrollTop=
arguments[0].scrollHeight",followers_popup)
time.sleep(5)
i am trying to make a program that checks every time a specific button is pressed, this would be done with python, i am thinking of using flask however i am not sure how to do it as the website is in EJS. please help and give suggestions on how to do it and if possible code snippets.
I can't find any docs on this, so please help.
Thanks
I'm trying to click on some element but it's not working:
driver.find_element_by_xpath("//span[text()='ENG']")
When I add:
driver.maximize_window()
before click action, it works, other codes are not working again.
I had similar problem
When I was looking for an element, it was not yet available in the code.
Fixed by adding
driver.implicitly_wait(30) ## 30 is the time he will wait
before searching for the element.
This line makes the code wait until the entire page is loaded before looking for an element.
I'm trying to click on some element via driver.find_element_by_xpath("//span[text()='ENG']"), but it's not working,
You need to post logs or be more specific. Are you getting an error on the call to find_element_by_xpath(), or when you call click as you mention below?
when I add driver.maximize_window() before click action, it works,
other codes are not working again, please advise which can be the
reason
The relevant code needs to be provided. I believe you're saying that when you call maximize_window() before you locate the element, it works, but if you don't call maximize window, it fails. This could be for a variety of reasons, but it sounds Javascript related. A similar question like this this could help. If maximize window doesn't actually help the issue, I would look into implicit waits or WebDriverWaits.
I'm new to coding using python and it's libraries, and also new to stackoverflow so I apologize if I'm not acquainted to some things.
Anyway to the question. I'm trying to write code that automates playing a video from the website that. Here's an example link:
http://www.shush.se/index.php?id=164&show=southpark
I've tried these methods:
driver.find_element_by_id("playerload").click()
driver.find_elements_by_xpath("./html/body/table/tbody/tr/td/div[#id='load']/div[#class='player']/div[#id='playerload']/div[1]")
But nothing happens. The program exits without error but the video does not
start playing.
I tried clicking a the id "jw6playerid5040619_wrapper" but the number associated with that changes every time a page loads.
Any advice? Thanks in advance!
Even though you don't know the exact id, you know that it will start with "jw6playerid". The following works for me:
elements = driver.find_elements_by_xpath("//*[contains(#id, 'jw6playerid')]")
elements[0].click()
I'm working on a bit of automation that basically opens YouTube, plays a particular video, then opens the "Stats for Nerds" dialog and grabs the info from it. This was working yesterday. Today, I added lines to set the video to 1080p, then go into full screen, and now it fails to work.
The following line works:
driver.find_element_by_id("movie_player").click()
While this set fails, throwing a StaleElementReferenceException:
element = driver.find_element_by_id("movie_player")
actions.move_to_element(element)
actions.context_click(element)
actions.perform()
Nothing I have done can avoid this. I've tried putting it in a try block, with and without some waits thrown in. Somehow the element is going stale in the very short time between finding and setting the element, and performing the context_click action.
Is there any way of getting around this?
Edit: I'll keep checking back in to see if someone knows a better way to do this, but for now, in the interest of expediency, I've just kludged it by using pymouse to actually take control of the mouse and right click.
I suspect the DOM changes if you mouse over the button. To workaround it, "refind" the element:
element = driver.find_element_by_id("movie_player")
actions.move_to_element(element).perform()
element = driver.find_element_by_id("movie_player")
actions.context_click(element).perform()