Elements/Images Problems in Selenium Django

Asked

Viewed 106 times

2

I’m having some element problem not load correctly on the page of ChromeDriver using Selenium in my Django app.

I shook Django’s test tool because in my scenario, I need the entire base loaded. And to load fixtures would take too long to start the tests. So I use a cloned production base, everything I create I delete at the end of the tests (and delete before also case of some error in the script).

The script works perfectly, it takes every right element, but visually it’s horrible. Some elements turn black, most (if not all) texts disappear (become invisible), etc. I can’t see several actions visually on the Chromedriver that it opens because of this.

I did a lot of research and didn’t see anyone with this problem. I wasn’t either, because I was using Django’s own tests.

What I did was create a new command in Django to continue having access to models, running Chrome normally.

It gives no error, only the browser window that opens, gets the elements not loaded perfectly.

Versions

ChromeDriver: 2.40
selenium==3.13.0
Django 2.0

My code

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from django.conf import settings
from django.core.management.base import BaseCommand

chromeOptions = Options()
chromeOptions.add_argument("--kiosk")

browser = webdriver.Chrome(settings.BASE_DIR + '/chromedriver', chrome_options=chromeOptions)

class Command(BaseCommand):
    help = 'Comando de testes'

    def handle(self, *args, **options):
        browser.get('/')
        ...

update

I am inserting an image and adding reward to get some feedback. The problem persists. I tried to update version of chromedrive, Selenium, etc. I believe the problem is related to Selenium running on a Python Command.

As you can see in the image below, the buttons (blue and gray) nay are appearing their texts, the 2 selects are not appearing the values, the images are with a black background as well as all the images of the site (I took a print just a piece for the sake of secrecy).

inserir a descrição da imagem aqui

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.