please help, I want to upload a picture, I tried a lot, it is not useful
bugh = WebDriverWait(driver, 2).until(EC.element_to_be_clickable((By.XPATH, "/html/body/div[2]/div[2]/div/div[5]/div[3]/form/div[6]/div/button[1]/div/div[1]/i")))#.click()
bugh.send_keys(r'N:\g\kkkp.png')
Related
We are going to include azure media player to provide some video content in our project. as part of testing, we need to automate the controls and verify text, image or frames if necessary. currently we are using selenium. Can we automate directly using selenium with javascriptexecutor or do we need any other plug-ins to do that?
any help would be appreciated.
Thanks in advance
All controls of azure media player can be automated using selenium. From the sample media player that I have gone through I could figure out that Play, pause and full screen buttons could be easily done using selenium element click method. while the video quality toggle and the volume can be automated easily using the actions class.
Clarification: Can I able to upload the screenshots taken by fastlane to s3 (or it will always give the html link to see the screenshots)
I have some clarification.
If I select the 1 in the below where the screenshots will be displayed.
How can I upload the image to s3
Or for all screenshots it will give any html link
If [3] is yes, does it give a link for single image
You can do whatever you want with the screenshots. Just take them after the script finishes on /{project}/fastlane/screenshots and upload it to S3 with the ruby S3 sdk.
I am trying to get the graph using TensorBoard for MNIST example.
I checked other tutorial, questions and it seems uploading file option is not coming under graph menu for me but I haven't found the reason for this.
P.S. I am able to generate graph file using write_graph which I want to display on TensorBoard.
Try using it on chrome instead of Firefox.
It isn't working on my Firefox too.
See this discussion for more info:
Is anyone else having trouble viewing the tensorboard/graph tab in firefox?
Does anyone know if it's possible to export HTML to PDF using the screenshot feature in Selenium Firefox WebDriver? I have a webpage which has print specific css which I need to download automatically. I understand that the screenshot feature takes a screenshot of the page as an image, but I was looking for a scalable PDF file which is good for print.
Screenshots in Selenium are saved as PNG. And PNG and PDF are different kind of formats. So Selenium cannot save your HTML page image directly as a PDF.
But, you could try to insert the PNG screenshot that Selenium takes and add it to a PDF.
Check this answer. Basically, you will need a library (like itext) and do something like:
// Take screenshot
driver.get("http://www.yourwebpage.com");
File screenshot = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(screenshot, new File("screenshot.png"));
// Create the PDF
Document document = new Document(PageSize.A4, 20, 20, 20, 20);
PdfWriter.getInstance(document, new FileOutputStream("my_web.pdf"));
document.open();
Image image = Image.getInstance(getClass().getResource("screenshot.png"));
document.add(image);
document.close();
Hope it helps!
EDIT
Since webs can be pretty high, you will probably need to check the documentation to see how you want to set your image in a PDF file.
A quick and easy way is to build an HTML file and embed the images as base64 data. You can then use any converter to get the document as a PDF.
An example with Python:
from selenium import webdriver
driver = webdriver.Firefox()
driver.get("https://www.google.co.uk");
# open new file
file = open(r"C:\temp\captures.html", "w")
file.write("<!DOCTYPE html><html><head></head><body width=\"600px\">")
# write image
file.write("<img src=\"data:image/png;base64,")
file.write(driver.get_screenshot_as_base64())
file.write("\">")
# close file
file.write("</body></html>")
file.close()
driver.quit()
Webdriver doesn't support "Export As PDF" function.
When you are not bound to Firefox and Webdriver, phantomjs could be an alternative.
Phantomjs is a headless browser with the ability to take screenshots as PDF.
The browser can be controlled directly by javascript.
Example: http://phantomjs.org/screen-capture.html
I know this is and oldie, and I apologize for that. But I still haven't found a solution to this.
I have recently tried to test my OpenLayers-based app with Selenium. But when I click on the map, it doesn't detect the click in Selenium. I have searched all over the Internet. Some people say it is a bug from Selenium, other claim to have found a workaround.
I have tried all these solutions and I am getting no results. The clicks still don't work.
http://osgeo-org.1560.x6.nabble.com/Testing-with-selenium-IDE-td5015680.html
Selenium IDE testing on maps(Open Layers)
http://comments.gmane.org/gmane.comp.gis.openlayers.user/18125
Could you please explain it better? Or maybe show an example?
Thanks
PS: I am new to Selenium, so it might be a bit more difficult for me to understand it.
I don't know if this is the best solution, but meanwhile I have started using Selenium WebDriver, more specifically, the Java version.
I have watched this video about automated tests and it helped a lot for getting on the right track. The video shows some examples of the use of Selenium WebDriver (the C# version, but it is similar to the Java version).
I have installed the ChromeDriver but you can also do it fully in Firefox.
I use JUnit for the tests.
In Selenium IDE, you "record" the tests and then you replay them.
Here, in Selenium WebDriver, you fully write the tests, without recording anything.
For example, you write code for the following steps:
1) Open the web page of my OpenLayers (or other) app.
WebDriver driver = new FirefoxDriver();
driver.get("http://localhost/myOpenLayersApp/index.php");
2) Click on the button that opens page X
driver.findElement(By.id("Button-Go-to-page-X")).click();
3) Checks if you have indeed navigated to page X
boolean check = driver.findElement(By.id("Header-X"))
.getText()
.equals("This is page X.");
Assert.assertTrue(check);
This was a very simple example of how to use Selenium WebDriver. At least, this is how I use it.
If you have more questions, please feel free to ask. :)
Note: Watch the video if you are new to this. It is a very good lesson about automated testing.