0

I need some help with a certain website for rendering, I've been trying so hard for making a good screenshot but actually I couldn't, then I noticed that it wasn't my code, it was the html or css, but, please, can anyone get a good screenshot for this website? (http://www.entel.pe)

When I get a screenshot it's rendered as responsive but it's a really huge pick with a really bad distribution.

Here's my code

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
import unittest, time, re


class TestPruebaHomeValoresEnlaces(unittest.TestCase):
    def setUp(self):
        dcap = dict(DesiredCapabilities.PHANTOMJS)
        dcap["phantomjs.page.settings.userAgent"] = (
            "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.122 Safari/537.36")
        #self.driver = webdriver.PhantomJS(executable_path=r'D:\Projects\webdrivers\phantomjs-2.1.1-windows\bin\phantomjs.exe')
        self.driver = webdriver.PhantomJS(desired_capabilities=dcap, executable_path=r'D:\Projects\webdrivers\phantomjs-2.1.1-windows\bin\phantomjs.exe', service_args=['--ignore-ssl-errors=true', '--ssl-protocol=any', '--web-security=false'])
        self.driver.set_window_size(1280, 720)
        self.base_url = "http://www.entel.pe"
        time.sleep(5)
        self.verificationErrors = []
        self.accept_next_alert = True


    def test_prueba_home_valores_enlaces(self):
        driver = self.driver
        driver.get(self.base_url + "/")
        driver.save_screenshot('screenshot.png')

    def is_element_present(self, how, what):
        try:
            self.driver.find_element(by=how, value=what)
        except NoSuchElementException as e:
            return False
        return True

    def is_alert_present(self):
        try:
            self.driver.switch_to_alert()
        except NoAlertPresentException as e:
            return False
        return True

    def close_alert_and_get_its_text(self):
        try:
            alert = self.driver.switch_to_alert()
            alert_text = alert.text
            if self.accept_next_alert:
                alert.accept()
            else:
                alert.dismiss()
            return alert_text
        finally:
            self.accept_next_alert = True

    def tearDown(self):
        self.driver.quit()
        self.assertEqual([], self.verificationErrors)


if __name__ == "__main__":
    unittest.main()

and this is my python setup

$ pip freeze
Appium-Python-Client==0.24
beautifulsoup4==4.5.3
html5lib==0.999999999
sauceclient==0.2.1
selenium==3.3.3
six==1.10.0
webencodings==0.5.1
xmlrunner==1.7.7

I hope someone can get a good screenshot and tell me how. Thanks

Steven
  • 1
  • 1
  • Have you tried something like this? http://stackoverflow.com/a/33348845/2386774 – JeffC Apr 17 '17 at 20:28
  • Thanks, but tha'ts not actually my issue, my issue is that screenshot is like 100Kpixel x 3Kpixel rendered as responsive, elements and images appears in a corner in their correct size – Steven Apr 18 '17 at 17:35
  • Ah... I assumed the elements weren't in their correct positions because jQuery or some other process wasn't done, etc. – JeffC Apr 18 '17 at 19:18

0 Answers0