seleniumbase / SeleniumBase

📊 Python's all-in-one framework for web crawling, scraping, testing, and reporting. Supports pytest. UC Mode provides stealth. Includes many tools.
https://seleniumbase.io
MIT License
4.46k stars 909 forks source link

How to change fonts in Seleniumbase Presenter? #2769

Closed asibhossen897 closed 1 month ago

asibhossen897 commented 1 month ago

Hello there! @mdmintz I'm trying to create some presentation that is in Bengali, but the Serif theme is not changing the Bengali font. Is there any way to change the font to my preference? Here is the code.

from seleniumbase import BaseCase
BaseCase.main(__name__, __file__)

class MyTestClass(BaseCase):
    def welcome_presentation(self):
        self.create_presentation(theme="serif", transition="fade")
        self.add_slide(
            "<h2>Python Essentials:</h2>\n"
            "<h3>Fundamentals and Practical Projects for Beginners</h3>\n"
            "<br /><hr /><br />\n"
            "<hd>Presented by <b>Asib Hossen</b></h4>\n"
            "<h4>Incieto Institute - 2024</h4>\n"
        )
        self.add_slide(
            "<h3>Assalamu'alaikum!</h3>\n"
            "<h3>Welcome to Incieto Institute!</h3>\n"
            "<h3>মডিউল ০ তে সবাইকে স্বাগতম!</h3>\n"
        )
        self.begin_presentation(filename="essentials.html")
mdmintz commented 1 month ago

Hello, the JS framework used for the presentations is Reveal.js - https://github.com/hakimel/reveal.js (specifically version 3.8.0: https://github.com/hakimel/reveal.js/releases/tag/3.8.0). The SeleniumBase Python code generates the Reveal.js code at runtime. If certain themes do not change the font for some languages, then it is out of SeleniumBase's control because all that is defined from within the Reveal.js library.

You can try the different themes and see if that helps: "serif" (default), "sky", "white", "black", "simple", "league", "moon", "night", "beige", "blood", and "solarized".

asibhossen897 commented 1 month ago

Thanks for the reply. Is it possible to save the presentation without having to open it in the browser? I tried

self.save_presentation(filename="")

but it also opens up the browser. I'm also having some issue in my Ubuntu 24.04 LTS when trying to use Seleniumbase. Even if I'm using --headed along with the command.

mdmintz commented 1 month ago

Use headless mode (--headless) to not see the browser window. Make sure you specify a Python filename when saving the presentation.

asibhossen897 commented 1 month ago

Ok, I'll try.