Getting the css attribute value on the site using Selenium - css

Good afternoon!
To check the font size of a CSS element on getbootstrap.com in the Firefox browser via Selenium, I use the following script:
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;
use Selenium::Firefox;
my $url = 'http://getbootstrap.com';
my $driver = Selenium::Firefox->new();
$driver->get($url);
my $elt = $driver->find_element(
'h1.mb-3.fw-semibold', 'css');
is $elt->get_css_attribute('font-size'), '72px',
'Masthead font size is unchanged';
$driver->quit();
done_testing;
When the script runs, the test fails:
❯ ./selenium_properties_css_attribute.pl
not ok 1 - Masthead font size is unchanged
# Failed test 'Masthead font size is unchanged'
# at ./selenium_properties_css_attribute.pl line 12.
# got: '64px'
# expected: '72px'
1..1
Killing Driver PID 4132 listening on port 45685...
# Looks like you failed 1 test of 1.
Can you please tell me why the test is failing? On the getbootstrap.com page in the Firefox browser, in the Computed tab for the element h1.mb-3.fw-semibold we see that the font size is 72px, but when we run the test we get 64px. Why?
The screenshot showing the font size is 72px:

The CSS for the heading includes:
.bd-masthead h1 {
font-size: calc(1.525rem + 3.3vw);
}
The font size is thus dependent on the width of the viewport. You are not explicitly controlling the width of the Firefox browser viewport.

Related

Change content assist font size only

For a while now I am looking for a solution to increase selected components font sizes in Eclipse IDE. This is due to the fact, that this IDE is completely unusable on high DPI monitor (unless one is a hawk).
In this answer ( Change Project Explorer tree view font size in Eclipse Oxygen ) I have found how to increase the font size of the project explorer and the outline:
.MPart Tree {
font-family: Consolas;
font-size: 14;
}
Now I am looking for a way to increase the font of context assist. This simple solution wont do:
* {
font-size: 14;
font-family: Hack;
}
It does increase all possible fonts in the editor, but it also forces this font size everywhere. For example, If I change the font of the editor (by doing ctrl - or ctrl shift +), then click away somewhere, the editor font will detrimentally go back to the set font in the css file. I believe this is somehow bugged. So the only way for me now is to increase the content assist font only. Is there a css tag for that? How to do this?

Is it possible to style RunKit?

Are there any possible ways to customize the styling of RunKit (https://runkit.com)? Like make the background of the editor to dark theme.
I tried injecting styles to the RunKit iframe but it does not work. Looking for any suggestions or any solutions.
1. Summary
Use RunKit theme maker.
It not documented for June 2019.
2. Demonstration
Gutter line numbers in left side has a bad visible.
Codepen demo:
I edit Text parameter in theme-maker.
Codepen demo:
(But besides line numbers RunKit also change text color of my notebook.)
3. Disclaimer
Data of this answer were relevant in June 2019 and may be obsolete in the future.
Method of this answer is uncomfortable, and I very hope that in the future there will be another.
4. Note
You can't overwrite embed RunKit and any another iframe styles of another domain via CSS:
How to apply CSS to iframe?
Override body style for content in an iframe
5. Sources
5.1. Without styles
I attach RunKit to existing element.
Codepen demo:
<script src="https://embed.runkit.com" data-element-id="KiraRunkit"></script>
<article>
<pre id="KiraRunkit">
var stringSimilarity = require('string-similarity')
var similarity = stringSimilarity.compareTwoStrings('Кира', 'Кирк');
</pre>
</article>
body
height 100%
overflow hidden
background-color sienna
article
margin-left 2rem
margin-right 2rem
// [INFO] Responsive iframe:
// https://medium.com/#mahbub_hemel/how-to-make-your-video-iframe-responsive-a8c5fda821ba
#KiraRunkit
width 100%
position relative
iframe
width 100%
height 100%
position absolute
/* [INFO] Instead of frameborder — http://stackoverflow.com/a/10831379/5951529 */
border 0
5.2. With styles
I programmaticaly create a notebook. Options:
element — HTML element, for which you will apply RunKit.
source — full source of your RunKit notebook; use \n for line breaking.
syntaxTheme — theme, that you create.
JavaScript code you find in your theme-maker page.
Codepen demo:
<script src="https://embed.runkit.com"></script>
<article>
<div id="KiraRunkit"></div>
</article>
body
height 100%
overflow hidden
background-color sienna
article
margin-left 2rem
margin-right 2rem
// [INFO] Responsive iframe:
// https://medium.com/#mahbub_hemel/how-to-make-your-video-iframe-responsive-a8c5fda821ba
#KiraRunkit
width 100%
position relative
iframe
width 100%
height 100%
position absolute
/* [INFO] Instead of frameborder — http://stackoverflow.com/a/10831379/5951529 */
border 0
##########
# RunKit #
##########
# Run npm code online in browser:
# https://runkit.com
# Needs use theme-maker, that change styles:
# https://runkit.com/docs/theme-maker
notebook = RunKit.createNotebook(
# [NOTE] Id required, class will not work
element: document.getElementById('KiraRunkit')
# [NOTE] You need paste here content of your RunKit notebook even if it big:
source: 'var stringSimilarity = require(\'string-similarity\')\n\n\
var similarity = stringSimilarity.compareTwoStrings(\'Кира\', \'Кирк\');'
# [INFO] https://runkit.com/docs/theme-maker/untilted-2jxk2crve1p7 theme
syntaxTheme: 'untilted-028u85ijnoyr')
6. Problems
You can have these problems, when you edit your theme via theme-maker:
If you need set exact color, You have to work hard, that make it in theme-maker.
After the second and subsequent theme editions, changes may not display.
Read notes in CoffeeScript file from previous section, that read about another limits.
7. Extra links
Discussion on RunKit forum
GitHub pull request, that add theme and gutterStyle properties

How to increase the font size of the request in postman tool?

I am using Postman tool for hitting the REST api with request and response. I want to increase the font size of the request. Under Settings there seem to be just one option to increase the font size of the response but not for request.
How can the font size of the request be increased?
Use Ctrl + (key) and =+ (key, near to Backspace button). Press all keys at the same time.
It's working.
You can change postman font in Settings->User Interface->Editor Font Size(px) option
see the image
The old postman app is just another webpage underneath it all, so use control +
For version 3, they've changed it to launch as a chrome desktop app. You can use a trick to open the developer tools, and change the fonts, or anything else, as you see fit. With Postman open, open a new tab in Chrome, and go to chrome://inspect/#apps. If Postman is open, you should see it listed in that page. Click the inspect link under it. Then you'll be able to inspect the elements whose fonts are too small, and change them. I believe it's just the input[type="text"].basic-text-input CSS selector, where you'll want to disable/change the 1.3rem font-size rule.
You can use the Settings > UI size option to change the font size of the interface.
The reason you can't zoom with ctrl++ is that you are probably using the plus key in the numpad section of your keyboard. You need to use the plus key next to backspace key.
keyboard screenshot here
Click Ctrl + + to increase the font size of postman.
For MAC Users.
Postman -> Preferences -> Settings -> Shortcuts
Command + or Command -
For native client
Go to Settings -> General -> User Interface -> Font size
If you install postman launcher, you will have a real web page like this:
You could change everything you want.
None of the answers here worked for changing the UI font size in the version of Postman that I have, 4.7.0. This is quick and dirty but it worked:
Open ~\AppData\Local\Google\Chrome\User Data\Default\Extensions\fhbjgbiflinjbdggehcddcbncdddomop\4.7.0_0\js\requester.js.
Replace all font: 12px with font: 1.25rem (or your REMs of choice).
Save and restart Postman.
To improve the font size forever, you just open the file "4.7.2_0/html/requester.html" with your text editor and add this code at the end of the file before the close of the tag </body>
In my case: C:\Users\Stepan\AppData\Local\Google\Chrome\User Data\Default\Extensions\fhbjgbiflinjbdggehcddcbncdddomop\4.7.2_0
<style> .editor.ace_editor { font-size: 18px !important; } </style>
Reopen the app/extension and enjoy :P
Click on File
Go to Settings
There's a section for User Interface
Change the "Editor Font Size(px) to whatever value you want. I use 14. Seems big enough.
Postman Settings Image
Top menu of Postman window: View → Zoom In / Zoom Out scales down the UI.
Go to C:\Users[User]\AppData\Local\Google\Chrome\User Data\Default\Extensions\fhbjgbiflinjbdggehcddcbncdddomop\3.2.8_0\css\requester, look for the style are you using in Postman, example "style.dark.css" and changue to 1.4rem:
#body, #code-data {
font-family: "PTMono", Consolas, Courier, monospace, sans-serif;
font-size: 1.2rem; // change to 1.4rem }

Increasing the font size of a button

I have an application made in struts 1.2 and it will be accessed by Desktop browser as well as Android browser. The layout of the DEsktop browser is fine but having problems with the layout in Android browser. Somehow I managed to do the UI look and feel changes but stuck with the button font.
Below is the code I wrote for the button:
<html:submit property="action" value="Login" style="width: 150px;height: 80px;"></html:submit>
The button appearence is fine but the font of the button i.e. Login is very small. I tried adding the font: 100px; in the style attribute but it did not worked.
Any suggestions on how to increase the font size of the submit button text?
Please let me know about this.
Regards,
The font property value must be either a single keyword indicating a system font or contain at least font size and font family, as in font: 100% Calibri. If you wish to set the font size only, do not use the font shorthand but the specific property font-size, e.g. font-size: 30px.
font css attribute isn't what you want.. Use font-size: 100px instead.
In fact with font you can specify multiple font related attributes. Documentation

Print Background colours in Chrome

I am trying to print a PHP generated document in chrome, on the browser it looks fine Link to the page I want to print But my printer will not print any coloured backgrounds, can anyone offer any suggestions please? Can I do this with CSS?
You adjust in the browser, whether the background colors and images are printed. See your browsers printing options.
Google Chrome offers this feature starting from version 26 (march 2013).
Also starting from version 17, Chrome allows changing the background print behavior programmatically by using -webkit-print-color-adjust:exact; in the element CSS to print the background.
Gordon's answer is great, but for people whose CSS skills are rusty, here's a more complete example.
Put the following in your document's <head> section.
<style type="text/css">
#media print { body { -webkit-print-color-adjust: exact; } }
</style>
By the way, although Chrome/Chromium's print dialog now has a Background graphics checkbox, it only seems to work if you do not click Print using system dialog (observed with Chromium in Linux).
Chrome > Print (cmd P) > click More Settings > Options: check Background graphics

Resources