Development

Gaining buy-in for accessibility can be challenging due to common myths and misunderstandings. For many, accessibility remains a big mystery.…

Add some summer sizzle to your design projects with trendy website elements. Learn what’s trending and how to use these…

I am able to modify http request header using BrowserMobProxy, the same way explained

https://sqa.stackexchange.com/a/37318/9043

But, the problem I am having at the moment is, that I am executing my scenarios on dev/local/playpen environment (environment before System integration testing). And to open the website on this environment needs proxy to set.

When I set my proxy then it fails to modify header and apply the proxy. When I comment the proxy part then it easily modifies the header.

BrowserMobProxy proxy = new BrowserMobProxyServer();
proxy.start(0);
Proxy seleniumProxy = ClientUtil.createSeleniumProxy(proxy);

proxy.addRequestFilter((request, contents, messageInfo)->{
request.headers().add(“some-header-attribute”, “RandomeValue”);
System.out.println(request.headers().entries().toString());
return null;
});

String _host = Utils.getConfigValue(“proxy.host”);
String _port = Utils.getConfigValue(“proxy.port”);

seleniumProxy.setProxyType(Proxy.ProxyType.MANUAL);
seleniumProxy.setHttpProxy(_host + “:” + _port);
seleniumProxy.setSslProxy(_host + “:” + _port);
seleniumProxy.setFtpProxy(_host + “:” + _port);
capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);

String proxyOption = “–proxy-server=” + seleniumProxy.getHttpProxy();
options.addArguments(proxyOption);

I’m trying to use a custom profile in Firefox with an add-on, I can open the profile, launch URL, I even see the add-on icon on top bar but is always set into the disabled mode, I need to set it to active all time. The add-on is ‘anonymous’
below is what I did, but no success.

public class SeleniumScript {
static WebDriver driver;
public static void main(String args[]) throws Exception {
System.setProperty(“webdriver.gecko.driver”, “E:\Library\geckodriver-v0.21.0-win32\geckodriver.exe”);
ProfilesIni profile2 = new ProfilesIni();
FirefoxProfile profile3 = profile2.getProfile(“AutoProfile”);
FirefoxOptions firefoxOptions = new FirefoxOptions();
firefoxOptions.setProfile(profile3);
File file = new File(“C:\Users\xxx\AppData\Roaming\Mozilla\Firefox\Profiles\vjo848oc.AutoProfile\extensions\client@anonymox.net.xpi”);
profile3.addExtension(file);
profile3.setPreference(“extensions.anonymox.currentVersion”, “4.1”);
driver = new FirefoxDriver(firefoxOptions);
String baseURL = “http://abc.com”;
driver.get(baseURL);
driver.manage().window().maximize();
}
}

I have an HTML element with a disabled attribute that is either true or `false, like:
<div class=”row” disabled=”false”>

or
<div class=”row” disabled=”true”>

I thought this would be straightforward to verify in Cypress by doing something like:
cy.get(“div.row”).should(“have.attr”, “disabled”, “false”)

However, when I tried that the test fails because Cypress reports that the disabled attribute of the element does not have the value “false” but instead has the value “disabled”.
If I open the browser inspection tool I can verify that the attribute is shown as I’ve written above. Any idea what is going wrong?